Collection<Module> (@NotNull Project project, @NonNls @NotNull String qualifiedName) { GlobalSearchScope allScope = GlobalSearchScope.allScope(project); JavaPsiFacade facade = JavaPsiFacade.getInstance(project); PsiClass[] possibleClasses = facade.findClasses(qualifiedName, allScope); if (possibleClasses.length == 0) { return Collections.emptyList(); } Set<Module> relevantModules = new LinkedHashSet<>(); ProjectFileIndex fileIndex = ProjectRootManager.getInstance(project).getFileIndex(); for (PsiClass aClass : possibleClasses) { VirtualFile classFile = aClass.getContainingFile().getVirtualFile(); for (OrderEntry orderEntry : fileIndex.getOrderEntriesForFile(classFile)) { relevantModules.add(orderEntry.getOwnerModule()); } } return relevantModules; }