Java 类com.intellij.util.indexing.AdditionalIndexedRootsScope 实例源码

项目:intellij-ce-playground    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    @Override
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}
项目:tools-idea    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      if (relevance != ResourceRelevance.NONE) {
        resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      }
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}
项目:consulo-xml    文件:IndexedRelevantResource.java   
public static <K, V extends Comparable> List<IndexedRelevantResource<K, V>> getResources(ID<K, V> indexId,
                                                                                         final K key,
                                                                                         @Nullable final Module module,
                                                                                         @NotNull Project project,
                                                                                         @Nullable final GlobalSearchScope additionalScope) {

  if (project.isDefault()) return Collections.emptyList();
  final ArrayList<IndexedRelevantResource<K, V>> resources = new ArrayList<IndexedRelevantResource<K, V>>();
  final ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex();
  FileBasedIndex.getInstance().processValues(indexId, key, null, new FileBasedIndex.ValueProcessor<V>() {
    public boolean process(VirtualFile file, V value) {
      ResourceRelevance relevance = ResourceRelevance.getRelevance(file, module, fileIndex, additionalScope);
      if (relevance != ResourceRelevance.NONE) {
        resources.add(new IndexedRelevantResource<K, V>(file, key, value, relevance));
      }
      return true;
    }
  }, new AdditionalIndexedRootsScope(GlobalSearchScope.allScope(project)));
  return resources;
}