当前位置: 首页>>代码示例>>Java>>正文


Java StringTokenizer类代码示例

本文整理汇总了Java中com.intellij.util.text.StringTokenizer的典型用法代码示例。如果您正苦于以下问题:Java StringTokenizer类的具体用法?Java StringTokenizer怎么用?Java StringTokenizer使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


StringTokenizer类属于com.intellij.util.text包,在下文中一共展示了StringTokenizer类的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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:CreateClassUtil.java

示例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()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:MicrodataUtil.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AntDomFileList.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:26,代码来源:AntDomTargetDependsListConverter.java

示例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;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:24,代码来源:AntDomTargetReference.java

示例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()]);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:20,代码来源:MicrodataUtil.java

示例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());
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:27,代码来源:HaxeCommonCompilerUtil.java

示例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());
  }
}
 
开发者ID:HaxeFoundation,项目名称:intellij-haxe,代码行数:20,代码来源:HaxeCommonCompilerUtil.java

示例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());
}
 
开发者ID:consulo,项目名称:consulo-haxe,代码行数:27,代码来源:HaxeCommonCompilerUtil.java

示例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();
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:ConsoleViewUtil.java

示例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()]);
}
 
开发者ID:consulo,项目名称:consulo-xml,代码行数:23,代码来源:MicrodataUtil.java

示例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;
}
 
开发者ID:consulo,项目名称:consulo-java,代码行数:19,代码来源:CreateClassUtil.java

示例13: findRootByClass

import com.intellij.util.text.StringTokenizer; //导入依赖的package包/类
@Nullable
@Override
public VirtualFile findRootByClass(List<VirtualFile> roots, String fqn) {
  for (VirtualFile file : roots) {
    if (findInFile(file, new StringTokenizer(fqn, "."))) return file;
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:LibrariesHelperImpl.java

示例14: isClassAvailable

import com.intellij.util.text.StringTokenizer; //导入依赖的package包/类
@Override
public boolean isClassAvailable(final String[] urls, String fqn) {
  for (String url : urls) {
    VirtualFile file = VirtualFileManager.getInstance().findFileByUrl(url);
    if (file == null) continue;
    if (!(file.getFileSystem() instanceof JarFileSystem) && !file.isDirectory()) {
      file = JarFileSystem.getInstance().getJarRootForLocalFile(file);
    }
    if (file == null) continue;
    if (findInFile(file, new StringTokenizer(fqn, "."))) return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:14,代码来源:LibrariesHelperImpl.java

示例15: 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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:10,代码来源:LibrariesHelperImpl.java


注:本文中的com.intellij.util.text.StringTokenizer类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。