本文整理汇总了Java中com.intellij.util.text.StringTokenizer.hasMoreTokens方法的典型用法代码示例。如果您正苦于以下问题:Java StringTokenizer.hasMoreTokens方法的具体用法?Java StringTokenizer.hasMoreTokens怎么用?Java StringTokenizer.hasMoreTokens使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.intellij.util.text.StringTokenizer
的用法示例。
在下文中一共展示了StringTokenizer.hasMoreTokens方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createParentDirectories
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
@NotNull
private static PsiDirectory createParentDirectories(@NotNull PsiDirectory directoryRoot, @NotNull String className) throws IncorrectOperationException {
final PsiPackage currentPackage = JavaDirectoryService.getInstance().getPackage(directoryRoot);
final String packagePrefix = currentPackage == null? null : currentPackage.getQualifiedName() + ".";
final String packageName = extractPackage(packagePrefix != null && className.startsWith(packagePrefix)?
className.substring(packagePrefix.length()) : className);
final StringTokenizer tokenizer = new StringTokenizer(packageName, ".");
while (tokenizer.hasMoreTokens()) {
String packagePart = tokenizer.nextToken();
PsiDirectory subdirectory = directoryRoot.findSubdirectory(packagePart);
if (subdirectory == null) {
directoryRoot.checkCreateSubdirectory(packagePart);
subdirectory = directoryRoot.createSubdirectory(packagePart);
}
directoryRoot = subdirectory;
}
return directoryRoot;
}
示例2: getReferencesForAttributeValue
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
public static PsiReference[] getReferencesForAttributeValue(@Nullable XmlAttributeValue element,
PairFunction<String, Integer, PsiReference> refFun) {
if (element == null) {
return PsiReference.EMPTY_ARRAY;
}
String text = element.getText();
String urls = StringUtil.unquoteString(text);
StringTokenizer tokenizer = new StringTokenizer(urls);
List<PsiReference> result = new ArrayList<PsiReference>();
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
int index = text.indexOf(token);
PsiReference ref = refFun.fun(token, index);
if (ref != null) {
result.add(ref);
}
}
return result.toArray(new PsiReference[result.size()]);
}
示例3: getFiles
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
@NotNull
protected List<File> getFiles(@Nullable AntDomPattern pattern, Set<AntFilesProvider> processed) {
final File root = getCanonicalFile(getDir().getStringValue());
if (root == null) {
return Collections.emptyList();
}
final ArrayList<File> files = new ArrayList<File>();
final String filenames = getFilesString().getStringValue();
if (filenames != null) {
final StringTokenizer tokenizer = new StringTokenizer(filenames, ", \t\n\r\f", false);
while (tokenizer.hasMoreTokens()) {
files.add(new File(root, tokenizer.nextToken()));
}
}
for (AntDomNamedElement child : getFiles()) {
final String fileName = child.getName().getStringValue();
if (fileName != null) {
files.add(new File(root, fileName));
}
}
return files;
}
示例4: fromString
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
public TargetResolver.Result fromString(@Nullable @NonNls String s, ConvertContext context) {
final AntDomProject project = context.getInvocationElement().getParentOfType(AntDomProject.class, false);
if (project == null) {
return null;
}
final AntDomTarget contextTarget = context.getInvocationElement().getParentOfType(AntDomTarget.class, false);
if (contextTarget == null) {
return null;
}
final List<String> refs;
if (s == null) {
refs = Collections.emptyList();
}
else {
refs = new ArrayList<String>();
final StringTokenizer tokenizer = new StringTokenizer(s, ",", false);
while (tokenizer.hasMoreTokens()) {
final String ref = tokenizer.nextToken();
refs.add(ref.trim());
}
}
final TargetResolver.Result result = TargetResolver.resolve(project.getContextAntProject(), contextTarget, refs);
result.setRefsString(s);
return result;
}
示例5: getExistingNames
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private Set<String> getExistingNames() {
final AntDomElement hostingElement = getHostingAntDomElement();
if (hostingElement == null) {
return Collections.emptySet();
}
final AntDomTarget contextTarget = hostingElement.getParentOfType(AntDomTarget.class, false);
if (contextTarget == null) {
return Collections.emptySet();
}
final Set<String> existing = new ArrayListSet<String>();
final String selfName = contextTarget.getName().getStringValue();
if (selfName != null) {
existing.add(selfName);
}
final String dependsString = contextTarget.getDependsList().getRawText();
if (dependsString != null) {
final StringTokenizer tokenizer = new StringTokenizer(dependsString, ",", false);
while (tokenizer.hasMoreTokens()) {
existing.add(tokenizer.nextToken().trim());
}
}
return existing;
}
示例6: getReferencesForAttributeValue
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
public static PsiReference[] getReferencesForAttributeValue(@Nullable XmlAttributeValue element,
PairFunction<String, Integer, PsiReference> refFun) {
if (element == null) {
return PsiReference.EMPTY_ARRAY;
}
String text = element.getText();
String urls = StringUtil.stripQuotesAroundValue(text);
StringTokenizer tokenizer = new StringTokenizer(urls);
List<PsiReference> result = new ArrayList<PsiReference>();
while (tokenizer.hasMoreTokens()) {
String token = tokenizer.nextToken();
int index = text.indexOf(token);
PsiReference ref = refFun.fun(token, index);
if (ref != null) {
result.add(ref);
}
}
return result.toArray(new PsiReference[result.size()]);
}
示例7: setupUserProperties
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static void setupUserProperties(List<String> commandLine, CompilationContext context) {
final HaxeModuleSettingsBase settings = context.getModuleSettings();
commandLine.add("-main");
commandLine.add(context.getCompilationClass());
final StringTokenizer argumentsTokenizer = new StringTokenizer(settings.getArguments());
while (argumentsTokenizer.hasMoreTokens()) {
commandLine.add(argumentsTokenizer.nextToken());
}
if (context.isDebug()) {
commandLine.add("-debug");
}
if (context.getHaxeTarget() == HaxeTarget.FLASH && context.isDebug()) {
commandLine.add("-D");
commandLine.add("fdb");
}
for (String sourceRoot : context.getSourceRoots()) {
commandLine.add("-cp");
commandLine.add(sourceRoot);
}
commandLine.add(context.getHaxeTarget().getCompilerFlag());
commandLine.add(context.getOutputFileName());
}
示例8: setupNME
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static void setupNME(List<String> commandLine, CompilationContext context) {
final HaxeModuleSettingsBase settings = context.getModuleSettings();
commandLine.add("run");
commandLine.add("nme");
commandLine.add("build");
commandLine.add(settings.getNmmlPath());
commandLine.add(settings.getNmeTarget().getTargetFlag());
if (context.isDebug()) {
commandLine.add("-debug");
commandLine.add("-Ddebug");
}
if (settings.getNmeTarget() == NMETarget.FLASH && context.isDebug()) {
commandLine.add("-Dfdb");
}
final StringTokenizer flagsTokenizer = new StringTokenizer(settings.getNmeFlags());
while (flagsTokenizer.hasMoreTokens()) {
commandLine.add(flagsTokenizer.nextToken());
}
}
示例9: setupUserProperties
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static void setupUserProperties(List<String> commandLine, CompilationContext context) {
final HaxeModuleSettingsBase settings = context.getModuleSettings();
commandLine.add("-main");
commandLine.add(settings.getMainClass());
final StringTokenizer argumentsTokenizer = new StringTokenizer(settings.getArguments());
while (argumentsTokenizer.hasMoreTokens()) {
commandLine.add(argumentsTokenizer.nextToken());
}
if (context.isDebug()) {
commandLine.add("-debug");
}
if (settings.getHaxeTarget() == HaxeTarget.FLASH && context.isDebug()) {
commandLine.add("-D");
commandLine.add("fdb");
}
for (String sourceRoot : context.getSourceRoots()) {
commandLine.add("-cp");
commandLine.add(sourceRoot);
}
commandLine.add(settings.getHaxeTarget().getCompilerFlag());
commandLine.add(settings.getOutputFileName());
}
示例10: printWithHighlighting
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
public static void printWithHighlighting(@Nonnull ConsoleView console, @Nonnull String text, @Nonnull SyntaxHighlighter highlighter, Runnable doOnNewLine) {
Lexer lexer = highlighter.getHighlightingLexer();
lexer.start(text, 0, text.length(), 0);
IElementType tokenType;
while ((tokenType = lexer.getTokenType()) != null) {
ConsoleViewContentType contentType = getContentTypeForToken(tokenType, highlighter);
StringTokenizer eolTokenizer = new StringTokenizer(lexer.getTokenText(), "\n", true);
while (eolTokenizer.hasMoreTokens()) {
String tok = eolTokenizer.nextToken();
console.print(tok, contentType);
if (doOnNewLine != null && "\n".equals(tok)) {
doOnNewLine.run();
}
}
lexer.advance();
}
}
示例11: getReferencesForAttributeValue
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
public static PsiReference[] getReferencesForAttributeValue(@Nullable XmlAttributeValue element, PairFunction<String, Integer, PsiReference> refFun)
{
if(element == null)
{
return PsiReference.EMPTY_ARRAY;
}
String text = element.getText();
String urls = StringUtil.unquoteString(text);
StringTokenizer tokenizer = new StringTokenizer(urls);
List<PsiReference> result = new ArrayList<>();
while(tokenizer.hasMoreTokens())
{
String token = tokenizer.nextToken();
int index = text.indexOf(token);
PsiReference ref = refFun.fun(token, index);
if(ref != null)
{
result.add(ref);
}
}
return result.toArray(new PsiReference[result.size()]);
}
示例12: createParentDirectories
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
@NotNull
private static PsiDirectory createParentDirectories(@NotNull PsiDirectory directoryRoot, @NotNull String className) throws IncorrectOperationException {
final PsiJavaPackage currentPackage = JavaDirectoryService.getInstance().getPackage(directoryRoot);
final String packagePrefix = currentPackage == null? null : currentPackage.getQualifiedName() + ".";
final String packageName = extractPackage(packagePrefix != null && className.startsWith(packagePrefix)?
className.substring(packagePrefix.length()) : className);
final StringTokenizer tokenizer = new StringTokenizer(packageName, ".");
while (tokenizer.hasMoreTokens()) {
String packagePart = tokenizer.nextToken();
PsiDirectory subdirectory = directoryRoot.findSubdirectory(packagePart);
if (subdirectory == null) {
directoryRoot.checkCreateSubdirectory(packagePart);
subdirectory = directoryRoot.createSubdirectory(packagePart);
}
directoryRoot = subdirectory;
}
return directoryRoot;
}
示例13: findInFile
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static boolean findInFile(VirtualFile root, final StringTokenizer filePath) {
if (!filePath.hasMoreTokens()) return true;
@NonNls String name = filePath.nextToken();
if (!filePath.hasMoreTokens()) {
name += ".class";
}
final VirtualFile child = root.findChild(name);
return child != null && findInFile(child, filePath);
}
示例14: findInFile
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static boolean findInFile(VirtualFile file, final StringTokenizer tokenizer) {
if (!tokenizer.hasMoreTokens()) return true;
@NonNls StringBuilder name = new StringBuilder(tokenizer.nextToken());
if (!tokenizer.hasMoreTokens()) {
name.append(".class");
}
final VirtualFile child = file.findChild(name.toString());
return child != null && findInFile(child, tokenizer);
}
示例15: readExternal
import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
@Override
public void readExternal(Element element) throws InvalidDataException {
proportions.clear();
String prop = element.getAttributeValue(ATTRIBUTE_PROPORTIONS);
String version = element.getAttributeValue(ATTRIBUTE_VERSION);
if (prop != null && Comparing.equal(version, DATA_VERSION)) {
StringTokenizer tokenizer = new StringTokenizer(prop, ",");
while (tokenizer.hasMoreTokens()) {
String p = tokenizer.nextToken();
proportions.add(Float.valueOf(p));
}
}
}