void (CheckedTreeNode node) { if (node.isLeaf()) { Object userObject = node.getUserObject(); if (userObject instanceof Tool && actionId.equals(((Tool)userObject).getActionId())) { nodes.add(node); } } else { for (int i = 0; i < node.getChildCount(); i++) { final TreeNode child = node.getChildAt(i); if (child instanceof CheckedTreeNode) { collect((CheckedTreeNode)child); } } } }