void (String uri, @NotNull Project project, @Nullable PsiFile file, @Nullable String location) { DefaultMutableTreeNode root = new DefaultMutableTreeNode(); mySchemasTree.setModel(new DefaultTreeModel(root)); ConfigFileSearcher searcher = new ConfigFileSearcher(file == null ? null : ModuleUtilCore.findModuleForPsiElement(file), project) { @Override public Set<PsiFile> search(@Nullable Module module, @NotNull Project project) { List<IndexedRelevantResource<String, XsdNamespaceBuilder>> resources = XmlNamespaceIndex.getAllResources(module, project); HashSet<PsiFile> files = new HashSet<>(); PsiManager psiManager = PsiManager.getInstance(project); for (IndexedRelevantResource<String, XsdNamespaceBuilder> resource : resources) { VirtualFile file = resource.getFile(); PsiFile psiFile = psiManager.findFile(file); ContainerUtil.addIfNotNull(files, psiFile); } return files; } }; searcher.search(); new ConfigFilesTreeBuilder(mySchemasTree).buildTree(root, searcher); TreeUtil.expandAll(mySchemasTree); mySchemasTree.setRootVisible(false); mySchemasTree.setShowsRootHandles(true); ColoredTreeCellRenderer renderer = new ColoredTreeCellRenderer() { @Override public void customizeCellRenderer(@NotNull JTree tree, Object value, boolean selected, boolean expanded, boolean leaf, int row, boolean hasFocus) { ConfigFilesTreeBuilder.renderNode(value, expanded, this); } }; renderer.setFont(EditorFontType.getGlobalPlainFont()); mySchemasTree.setCellRenderer(renderer); MouseAdapter mouseAdapter = new MouseAdapter() { @Override public void mouseClicked(MouseEvent e) { if (e.getClickCount() > 1 && isOKActionEnabled()) { doOKAction(); } } }; mySchemasTree.addMouseListener(mouseAdapter); mySchemasTree.getSelectionModel().addTreeSelectionListener(new TreeSelectionListener() { @Override public void valueChanged(TreeSelectionEvent e) { validateInput(); } }); mySchemasTree.setSelectionRow(0); PsiFile schema = null; if (file != null) { schema = XmlUtil.findNamespaceByLocation(file, uri); } else if (location != null) { VirtualFile virtualFile = VfsUtilCore.findRelativeFile(location, null); if (virtualFile != null) { schema = PsiManager.getInstance(project).findFile(virtualFile); } } if (schema != null) { DefaultMutableTreeNode node = TreeUtil.findNodeWithObject(root, schema); if (node != null) { mySchemaFound = true; TreeUtil.selectNode(mySchemasTree, node); } myFileTextField.setText(schema.getVirtualFile().getCanonicalPath()); } }