• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java StringTokenizer类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



StringTokenizer类属于com.intellij.util.text包,在下文中一共展示了StringTokenizer类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


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


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


示例18: fromString

import com.intellij.util.text.StringTokenizer; //导入依赖的package包/类
@Nullable
@Override
public SplitterProportionsDataImpl fromString(@NotNull String value) {
  SplitterProportionsDataImpl data = new SplitterProportionsDataImpl();
  StringTokenizer tokenizer = new StringTokenizer(value, ",");
  while (tokenizer.hasMoreTokens()) {
    data.proportions.add(Float.valueOf(tokenizer.nextToken()));
  }
  return data;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:SplitterProportionsDataImpl.java


示例19: findSuitableFilesFor

import com.intellij.util.text.StringTokenizer; //导入依赖的package包/类
public static List<VirtualFile> findSuitableFilesFor(final String filePath, final Project project) {
  final ProjectFileIndex index = ProjectRootManager.getInstance(project).getFileIndex();

  // at first let's try to find file as is, by it's real path
  // and check that file belongs to current project
  // this location provider designed for tests thus we will check only project content
  // (we cannot check just sources or tests folders because RM doesn't use it
  final VirtualFile file = getByFullPath(filePath);
  final boolean inProjectContent = file != null && (index.isInContent(file));

  if (inProjectContent) {
    return Collections.singletonList(file);
  }

  //split file by "/" in parts
  final LinkedList<String> folders = new LinkedList<String>();
  final StringTokenizer st = new StringTokenizer(filePath, "/", false);
  String fileName = null;
  while (st.hasMoreTokens()) {
    final String pathComponent = st.nextToken();
    if (st.hasMoreTokens()) {
      folders.addFirst(pathComponent);
    } else {
      // last token
      fileName = pathComponent;
    }
  }
  if (fileName == null) {
    return Collections.emptyList();
  }
  final List<VirtualFile> target = findFilesClosestToTarget(folders, collectCandidates(project, fileName, true), MIN_PROXIMITY_THRESHOLD);
  return target.isEmpty() && file != null ? Collections.singletonList(file) : target;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:34,代码来源:TestsLocationProviderUtil.java


示例20: parseIgnoredVariables

import com.intellij.util.text.StringTokenizer; //导入依赖的package包/类
private Collection<String> parseIgnoredVariables() {
  final String s = myIgnoredVariables.getText();
  final List<String> ignored = new ArrayList<String>();
  final StringTokenizer st = new StringTokenizer(s, ";");
  while (st.hasMoreElements()) {
    ignored.add(st.nextElement().trim());
  }

  return ignored;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:PathMacroListEditor.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java OnDataPointListener类代码示例发布时间:2022-05-22
下一篇:
Java DateTickMarkPosition类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap