boolean (@NotNull Processor<? super VirtualFile> processor) { if (myType == VIRTUAL_FILES) { return getFileSet().process(file -> isFilteredOut(file) || processor.process(file)); } if (myFilesSet != null) { return myFilesSet.process(processor); } FileIndex projectFileIndex = ProjectRootManager.getInstance(myProject).getFileIndex(); if (myScope instanceof GlobalSearchScope) { ContentIterator contentIterator = createScopeIterator(processor, myScope); if (!projectFileIndex.iterateContent(contentIterator)) return false; if (mySearchInLibraries) { VirtualFile[] libraryRoots = LibraryUtil.getLibraryRoots(myProject, false, false); for (VirtualFile libraryRoot : libraryRoots) { if (!VfsUtilCore.iterateChildrenRecursively(libraryRoot, VirtualFileFilter.ALL, contentIterator)) return false; } } return true; } if (myScope instanceof LocalSearchScope) { PsiElement[] psiElements = ((LocalSearchScope)myScope).getScope(); Set<VirtualFile> files = new HashSet<>(); for (PsiElement element : psiElements) { VirtualFile file = ReadAction.compute(() -> PsiUtilCore.getVirtualFile(element)); if (file != null && files.add(file)) { if (!processor.process(file)) return false; } } return true; } List<Module> modules = myModule != null ? Collections.singletonList(myModule) : myModules; if (modules != null) { for (Module module : modules) { FileIndex moduleFileIndex = ModuleRootManager.getInstance(module).getFileIndex(); if (!moduleFileIndex.iterateContent(createScopeIterator(processor, null))) { return false; } } return true; } if (myElement instanceof PsiDirectory) { return accept((PsiDirectory)myElement, processor); } if (myElement != null) { VirtualFile file = ReadAction.compute(() -> PsiUtilCore.getVirtualFile(myElement)); return file == null || processor.process(file); } return projectFileIndex.iterateContent(createScopeIterator(processor, null)); }