boolean (@NotNull VirtualFile file) { if (!super.contains(file)) { return false; } VirtualFile root = file; if (!file.isDirectory()) { root = file.getParent().getParent(); if (root == null) { return false; } Project project = getProject(); if (project == null) { return false; } ProjectFileIndex fileIndex = ProjectFileIndex.getInstance(project); if (!root.equals(fileIndex.getSourceRootForFile(file)) && !root.equals(fileIndex.getClassRootForFile(file))) { return false; } } if (JavaModuleNameIndex.descriptorFile(root) != null) { return false; } return true; }