boolean (@NotNull JTree tree, @NotNull DefaultMutableTreeNode node) { TreePath[] selectionPaths = tree.getSelectionPaths(); if (selectionPaths == null || selectionPaths.length == 0) return false; TreePath path = new TreePath(node.getPath()); for (TreePath selectionPath : selectionPaths) { if (path.isDescendant(selectionPath)) return true; } return false; }