boolean (@NotNull JTree tree, @NotNull List<TreePath> paths, @NotNull TreeVisitor visitor) { if (paths.isEmpty()) { SelectInProjectViewImplKt.getLOG().debug("Nothing to select"); return false; } if (paths.size() > 1 && myMultiSelectionEnabled) { if (visitor instanceof ProjectViewNodeVisitor nodeVisitor) { return selectPaths(tree, new SelectionDescriptor(nodeVisitor.getElement(), nodeVisitor.getFile(), paths)); } if (visitor instanceof ProjectViewFileVisitor fileVisitor) { return selectPaths(tree, new SelectionDescriptor(null, fileVisitor.getElement(), paths)); } } if (!myMultiSelectionEnabled) { SelectInProjectViewImplKt.getLOG().debug("Selecting only the first path because multi-selection is disabled"); } TreePath path = paths.get(0); tree.expandPath(path); // request to expand found path TreeUtil.selectPaths(tree, path); // select and scroll to center if (SelectInProjectViewImplKt.getLOG().isDebugEnabled()) { SelectInProjectViewImplKt.getLOG().debug("Selected the only path: " + path); } return true; }