CheckedTreeNode (TreeNode node, String name) { Ref<CheckedTreeNode> found = new Ref<>(); visitChildren(node, new CheckedNodeVisitor() { @Override public void visit(CheckedTreeNode node) { if (found.get() != null) return; Object userObject = node.getUserObject(); if (userObject instanceof IntentionActionMetaData) { String text = getNodeText(node, true); if (name.equals(text)) { found.set(node); } } else { CheckedTreeNode child = findChildRecursively(node, name); if (child != null) { found.set(child); } } } }); return found.get(); }