boolean (@NotNull final VirtualFile directoryFile, @NotNull Project project) { final ProjectFileIndex projectFileIndex = ProjectRootManager.getInstance(project).getFileIndex(); final VirtualFile contentRootForFile = projectFileIndex.getContentRootForFile(directoryFile); return directoryFile.equals(contentRootForFile); }