boolean (@NotNull VirtualFile directoryFile, @NotNull Project project) { final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); if (projectFileIndex.isInLibraryClasses(directoryFile)) { final VirtualFile parent = directoryFile.getParent(); return parent == null || !projectFileIndex.isInLibraryClasses(parent); } return false; }