boolean (Project project, PsiDirectory targetElement) { final PsiPackage psiPackage = JavaDirectoryService.getInstance().getPackage(targetElement); if (psiPackage != null) { final Module module = ModuleUtilCore.findModuleForFile(targetElement.getVirtualFile(), project); if (module != null && psiPackage.getDirectories(GlobalSearchScope.moduleScope(module)).length > 1) { return true; } } return false; }