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; }
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; }