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


Java CommonProcessors.CollectUniquesProcessor方法代码示例

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


在下文中一共展示了CommonProcessors.CollectUniquesProcessor方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: searchMethodCalls

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static Set<PsiMethodCallExpression> searchMethodCalls(@NotNull final PsiMethod psiMethod, @NotNull SearchScope searchScope) {
  final Set<PsiMethodCallExpression> callExpressions = new com.intellij.util.containers.HashSet<PsiMethodCallExpression>();
  final CommonProcessors.CollectUniquesProcessor<PsiReference> consumer = new CommonProcessors.CollectUniquesProcessor<PsiReference>();

  MethodReferencesSearch.search(psiMethod, searchScope, true).forEach(consumer);

  for (PsiReference psiReference : consumer.getResults()) {
    final PsiMethodCallExpression methodCallExpression =
      PsiTreeUtil.getParentOfType(psiReference.getElement(), PsiMethodCallExpression.class);

    if (methodCallExpression != null) {
      callExpressions.add(methodCallExpression);
    }
  }


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

示例2: getAllRegisteredIds

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
public static Collection<String> getAllRegisteredIds(Project project) {
  CommonProcessors.CollectUniquesProcessor<String> processor = new CommonProcessors.CollectUniquesProcessor<String>();
  FileBasedIndex.getInstance().processAllKeys(KEY, processor, project);
  final Collection<String> results = new ArrayList<String>(processor.getResults());
  final GlobalSearchScope searchScope = GlobalSearchScope.projectScope(project);
  for (Iterator<String> iterator = results.iterator(); iterator.hasNext(); ) {
    final String id = iterator.next();
    final List<Set<String>> values = FileBasedIndex.getInstance().getValues(KEY, id, searchScope);
    if (!values.isEmpty()) {
      final Set<String> pathSet = values.get(0);
      if (pathSet != null) {
        continue;
      }
    }
    iterator.remove();
  }
  return results;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:20,代码来源:JavaFxIdsIndex.java

示例3: findClasses

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@NotNull
@Override
public PsiClass[] findClasses(@NotNull String qualifiedName, @NotNull GlobalSearchScope scope) {
  Project project = scope.getProject();
  if (project == null || !ProjectFacetManager.getInstance(project).hasFacets(AndroidFacet.ID)) {
    return PsiClass.EMPTY_ARRAY;
  }

  if (INTERNAL_R_CLASS_QNAME.equals(qualifiedName)) {
    CommonProcessors.CollectUniquesProcessor<PsiClass> processor = new CommonProcessors.CollectUniquesProcessor<PsiClass>();
    processInternalRClasses(project, scope, processor);
    Collection<PsiClass> results = processor.getResults();
    return results.isEmpty() ? PsiClass.EMPTY_ARRAY : results.toArray(new PsiClass[results.size()]);
  }

  final int lastDot = qualifiedName.lastIndexOf('.');
  if (lastDot < 0) {
    return PsiClass.EMPTY_ARRAY;
  }
  final String shortName = qualifiedName.substring(lastDot + 1);
  final String parentName = qualifiedName.substring(0, lastDot);

  if (shortName.length() == 0 || !parentName.endsWith(".R")) {
    return PsiClass.EMPTY_ARRAY;
  }
  List<PsiClass> result = new SmartList<PsiClass>();
  for (PsiClass parentClass : JavaPsiFacade.getInstance(project).findClasses(parentName, scope)) {
    ContainerUtil.addIfNotNull(result, parentClass.findInnerClassByName(shortName, false));
  }
  return result.isEmpty() ? PsiClass.EMPTY_ARRAY : result.toArray(new PsiClass[result.size()]);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:32,代码来源:AndroidPsiElementFinder.java

示例4: getDependencies

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static Collection<XmlFile> getDependencies(XmlFile element) {
  final CommonProcessors.CollectUniquesProcessor<XmlFile> processor = new CommonProcessors.CollectUniquesProcessor<XmlFile>() {
    @Override
    public boolean process(XmlFile file) {
      if (!getResults().contains(file)) {
        XsltIncludeIndex.processForwardDependencies(file, this);
      }
      return super.process(file);
    }
  };
  XsltIncludeIndex.processForwardDependencies(element, processor);
  return processor.getResults();
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:15,代码来源:ResolveUtil.java

示例5: getVariants

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@RequiredReadAction
@NotNull
@Override
public Object[] getVariants()
{
	CommonProcessors.CollectUniquesProcessor<CSharpPreprocessorVariable> processor = new CommonProcessors.CollectUniquesProcessor<>();
	collect(processor);
	return processor.toArray(CSharpPreprocessorVariable.ARRAY_FACTORY);
}
 
开发者ID:consulo,项目名称:consulo-csharp,代码行数:10,代码来源:CSharpPreprocessorReferenceExpressionImpl.java

示例6: getDependencies

import com.intellij.util.CommonProcessors; //导入方法依赖的package包/类
@Nullable
public static Collection<XmlFile> getDependencies(XmlFile element) {
	final CommonProcessors.CollectUniquesProcessor<XmlFile> processor = new CommonProcessors.CollectUniquesProcessor<XmlFile>() {
		@Override
		public boolean process(XmlFile file) {
			if (!getResults().contains(file)) {
				XsltIncludeIndex.processForwardDependencies(file, this);
			}
			return super.process(file);
		}
	};
	XsltIncludeIndex.processForwardDependencies(element, processor);
	return processor.getResults();
}
 
开发者ID:consulo,项目名称:consulo-xslt,代码行数:15,代码来源:ResolveUtil.java


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