Set<PsiFile> (DefaultMutableTreeNode root, ConfigFileSearcher... searchers) { final MultiMap<Module, PsiFile> files = new MultiMap<>(); final MultiMap<VirtualFile, PsiFile> jars = new MultiMap<>(); final MultiMap<VirtualFile, PsiFile> virtualFiles = new MultiMap<>(); for (ConfigFileSearcher searcher : searchers) { files.putAllValues(searcher.getFilesByModules()); jars.putAllValues(searcher.getJars()); virtualFiles.putAllValues(searcher.getVirtualFiles()); } final Set<PsiFile> psiFiles = new HashSet<>(buildModuleNodes(files, jars, root)); for (Map.Entry<VirtualFile, Collection<PsiFile>> entry : virtualFiles.entrySet()) { DefaultMutableTreeNode node = createFileNode(entry.getKey()); List<PsiFile> list = new ArrayList<>(entry.getValue()); list.sort(FILE_COMPARATOR); for (PsiFile file : list) { node.add(createFileNode(file)); } root.add(node); } return psiFiles; }