AnalysisScope (@NotNull Project defaultProject) { ProjectFileIndex fileIndex = ProjectRootManager.getInstance(defaultProject).getFileIndex(); HashSet<Module> modules = new HashSet<>(); if (myType == FILE || myType == DIRECTORY) { VirtualFile vFile = ((PsiFileSystemItem)myElement).getVirtualFile(); modules.addAll(getAllInterestingModules(fileIndex, vFile)); } else if (myType == MODULE) { modules.add(myModule); } else if (myType == MODULES) { modules.addAll(myModules); } return collectScopes(defaultProject, modules); }