void (AbstractProjectViewPane viewPane) { if (viewPane == null) { return; } AbstractTreeBuilder treeBuilder = viewPane.getTreeBuilder(); JTree tree = viewPane.myTree; if (treeBuilder == null) { List<TreeVisitor> visitors = AbstractProjectViewPane.createVisitors(elements); if (1 == visitors.size()) { TreeUtil.promiseSelect(tree, visitors.get(0)); } else if (!visitors.isEmpty()) { TreeUtil.promiseSelect(tree, visitors.stream()); } } else { DefaultTreeModel treeModel = (DefaultTreeModel)tree.getModel(); List<TreePath> paths = new ArrayList<>(elements.length); for (final Object element : elements) { DefaultMutableTreeNode node = treeBuilder.getNodeForElement(element); if (node == null) { treeBuilder.buildNodeForElement(element); node = treeBuilder.getNodeForElement(element); } if (node != null) { paths.add(new TreePath(treeModel.getPathToRoot(node))); } } if (!paths.isEmpty()) { tree.setSelectionPaths(toTreePathArray(paths)); } } }