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


Java StringTokenizer.nextToken方法代码示例

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


在下文中一共展示了StringTokenizer.nextToken方法的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: 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

示例4: 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

示例5: 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

示例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.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

示例7: 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

示例8: 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

示例9: 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

示例10: 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

示例11: 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

示例12: LabeledIcon

import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
/**
 * @param icon     not <code>null</code> icon.
 * @param text     to be painted under the <code>icon<code>. This parameter can
 *                 be <code>null</code> if text isn't specified. In that case <code>LabeledIcon</code>
 * @param mnemonic
 */
public LabeledIcon(Icon icon, String text, String mnemonic) {
  myIcon = icon;
  myMnemonic = mnemonic;
  if (text != null) {
    StringTokenizer tokenizer = new StringTokenizer(text, "\n");
    myStrings = new String[tokenizer.countTokens()];
    for (int i = 0; tokenizer.hasMoreTokens(); i++) {
      myStrings[i] = tokenizer.nextToken();
    }
  }
  else {
    myStrings = null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:21,代码来源:LabeledIcon.java

示例13: HorizontalLabeledIcon

import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
/**
 * @param icon not <code>null</code> icon.
 * @param text to be painted under the <code>icon<code>. This parameter can
 *             be <code>null</code> if text isn't specified. In that case <code>LabeledIcon</code>
 */
public HorizontalLabeledIcon(Icon icon, String text, String mnemonic) {
  myIcon = icon;
  if (text != null) {
    StringTokenizer tokenizer = new StringTokenizer(text, "\n");
    myStrings = new String[tokenizer.countTokens()];
    for (int i = 0; tokenizer.hasMoreTokens(); i++) {
      myStrings[i] = tokenizer.nextToken();
    }
  }
  else {
    myStrings = null;
  }
  myMnemonic = mnemonic;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:HorizontalLabeledIcon.java

示例14: addAdditionalClassPath

import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static void addAdditionalClassPath(Collection<URL> classpath) {
  try {
    StringTokenizer tokenizer = new StringTokenizer(System.getProperty(PROPERTY_ADDITIONAL_CLASSPATH, ""), File.pathSeparator + ",", false);
    while (tokenizer.hasMoreTokens()) {
      String pathItem = tokenizer.nextToken();
      classpath.add(new File(pathItem).toURI().toURL());
    }
  }
  catch (MalformedURLException e) {
    getLogger().error(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:BootstrapClassLoaderUtil.java

示例15: addAdditionalClassPath

import com.intellij.util.text.StringTokenizer; //导入方法依赖的package包/类
private static void addAdditionalClassPath(@NotNull Collection<URL> classpath) throws MalformedURLException {
  StringTokenizer tokenizer = new StringTokenizer(System.getProperty(PROPERTY_ADDITIONAL_CLASSPATH, ""), File.pathSeparator, false);
  while (tokenizer.hasMoreTokens()) {
    String pathItem = tokenizer.nextToken();
    classpath.add(new File(pathItem).toURI().toURL());
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:IdeTestApplication.java


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