boolean (TreePath path) { if (myTree == null || path == null) return false; Object last = path.getLastPathComponent(); if (last instanceof DefaultMutableTreeNode mutableTreeNode) { boolean expanded = false; Enumeration<?> children = mutableTreeNode.children(); if (children.hasMoreElements()) { while (children.hasMoreElements()) { Object next = children.nextElement(); if (next != null) { expanded = maybeExpand(path.pathByAddingChild(next)) || expanded; } } if (expanded) return true; Object lastUserObject = mutableTreeNode.getUserObject(); if (lastUserObject instanceof ExecutionNode) { if (((ExecutionNode)lastUserObject).isAutoExpandNode()) { if (!myTree.isExpanded(path)) { myTree.expandPath(path); return true; } } } } } return false; }