boolean (@NotNull PsiPackage psiPackage, @NotNull final GlobalSearchScope scope, @NotNull final Processor<? super PsiDirectory> consumer, boolean includeLibrarySources) { final PsiManager psiManager = PsiManager.getInstance(myProject); return PackageIndex.getInstance(myProject) .getDirsByPackageName(psiPackage.getQualifiedName(), includeLibrarySources) .forEach(new ReadActionProcessor<VirtualFile>() { @Override public boolean processInReadAction(final VirtualFile dir) { if (!scope.contains(dir)) return true; PsiDirectory psiDir = psiManager.findDirectory(dir); return psiDir == null || consumer.process(psiDir); } }); }