boolean (Module module, Processor<Object> processor) { final PsiManager psiManager = PsiManager.getInstance(module.getProject()); ModuleRootManager moduleRootManager = ModuleRootManager.getInstance(module); VirtualFile[] roots = moduleRootManager.getContentRoots(); for (final VirtualFile root : roots) { final PsiDirectory psiDirectory = ReadAction.compute(() -> psiManager.findDirectory(root)); if (psiDirectory != null) { if (!processor.process(psiDirectory)) return false; } } return true; }