Recursively expand all paths in the given tree, starting with the
given path

@param tree The tree
@param treePath The current tree path
343033
private static void expandAllRecursively(JTree tree, TreePath treePath)
    {
        TreeModel model = tree.getModel();
        Object lastPathComponent = treePath.getLastPathComponent();
        int childCount = model.getChildCount(lastPathComponent);
        if (childCount == 0)
        {
            return;
        }
        tree.expandPath(treePath);
        for (int i=0; i<childCount; i++)
        {
            Object child = model.getChild(lastPathComponent, i);
            int grandChildCount = model.getChildCount(child);
            if (grandChildCount > 0)
            {
                class LocalTreePath extends TreePath
                {
                    private static final long serialVersionUID = 0;
                    public LocalTreePath(
                        TreePath parent, Object lastPathComponent)
                    {
                        super(parent, lastPathComponent);
                    }
                }
                TreePath nextTreePath = new LocalTreePath(treePath, child);
                expandAllRecursively(tree, nextTreePath);
            }
        }
    }
623272
public static TreePath getPath(TreePath path, Tree target) {
        path.getClass();
        target.getClass();

        class Result extends Error {
            static final long serialVersionUID = -5942088234594905625L;
            TreePath path;
            Result(TreePath path) {
                this.path = path;
            }
        }

        class PathFinder extends TreePathScanner<TreePath,Tree> {
            public TreePath scan(Tree tree, Tree target) {
                if (tree == target) {
                    throw new Result(new TreePath(getCurrentPath(), target));
                }
                return super.scan(tree, target);
            }
        }

        if (path.getLeaf() == target) {
            return path;
        }

        try {
            new PathFinder().scan(path, target);
        } catch (Result result) {
            return result.path;
        }
        return null;
    }
537113
public static boolean deletePathRecursive(Tree<ResourceMeta> tree, Path path){
        if(tree.hasResource(path)) {
            //delete just this resource
            return tree.deleteResource(path);
        }else if (tree.hasDirectory(path)) {
            //list resources and delete
            Set<Resource<ResourceMeta>> resources = tree.listDirectory(path);
            boolean failed=false;
            for (Resource<ResourceMeta> resource : resources) {
                if(resource.isDirectory()){
                    if(!deletePathRecursive(tree,resource.getPath())){
                        failed=true;
                    }
                }else {
                    if(!tree.deleteResource(resource.getPath())){
                        failed=true;
                    }
                }
            }
            return !failed;
        }else{
            return true;
        }
    }
1322340
protected void setTreeGraph(TreeGraph tg) {
    this.tg = tg;
    for (TreeGraphNode child : children) {
      child.setTreeGraph(tg);
    }
  }
341923
public void expandClasspath(String... paths) {
        if (paths == null || paths.length == 0) {
            return;
        }
        for (String path: paths) {
            expandClasspath(new File(PathUtil.resolve(path)));
        }
    }
313877
public static TreePath createTreePathToRoot(
        TreeModel treeModel, Object node)
    {
        List<Object> nodes = new ArrayList<Object>();
        nodes.add(node);
        Object current = node;
        while (true)
        {
            Object parent = getParent(treeModel, current);
            if (parent == null)
            {
                break;
            }
            nodes.add(0, parent);
            current = parent;
        }
        TreePath treePath = new TreePath(nodes.toArray());
        return treePath;
    }
358646
public static Tree buildTree(TreebankNode node) throws Exception {
        if (node.getLeaf())
            return toTree(node);
        else {
            List<TreebankNode> preChildren = children(node);
            List<Tree> children = new ArrayList<>();
            Tree t = toTree(node);
            for (int i = 0; i < preChildren.size(); i++) {
                children.add(buildTree(preChildren.get(i)));
            }

            t.connect(children);
            return t;

        }



    }
77627
void setTreePath(TreePath treePath) {
        this.treePath = treePath;
        documentation = getCommentText(treePath);
        comment = null;
    }
1257066
def expand_parents node
      _path = node.tree_path
      _path.each do |e| 
        # if already expanded parent then break we should break
        #set_expanded_state(e, true) 
        expand_node(e)
      end
    end
80964
public void setTreeModel(final TreeItemModel treeModel) {
		getOrCreateComponentModel().treeModel = treeModel;
		clearItemIdMaps();
		setSelectedRows(null);
		setExpandedRows(null);
		setCustomTree((TreeItemIdNode) null);
	}
903478
private static void processJsonToTree(final TreeItemIdNode parentNode, final JsonObject json) {

		String id = json.getAsJsonPrimitive("id").getAsString();
		JsonPrimitive expandableJson = json.getAsJsonPrimitive("expandable");

		TreeItemIdNode node = new TreeItemIdNode(id);
		if (expandableJson != null && expandableJson.getAsBoolean()) {
			node.setHasChildren(true);
		}
		parentNode.addChild(node);

		JsonArray children = json.getAsJsonArray("items");
		if (children != null) {
			for (int i = 0; i < children.size(); i++) {
				JsonObject child = children.get(i).getAsJsonObject();
				processJsonToTree(node, child);
			}
		}
	}
773668
public static TreePath getPath(CompilationUnitTree unit, Tree target) {
        return getPath(new TreePath(unit), target);
    }
30325
public void deletePath(String path) {
        if (path == null) {
            return;
        }
        String[] pathComponents = path.split("/");
        TrieNode parent = rootNode;
        String part = null;
        if (pathComponents.length <= 1) {
            throw new IllegalArgumentException("Invalid path " + path);
        }
        for (int i=1; i<pathComponents.length; i++) {
            part = pathComponents[i];
            if (parent.getChild(part) == null) {
                //the path does not exist
                return;
            }
            parent = parent.getChild(part);
            LOG.info(parent);
        }
        TrieNode realParent  = parent.getParent();
        realParent.deleteChild(part);
    }
430002
public void openForTree(ItemClickEvent event, Tree tree) {

        fireEvent(new ContextMenuOpenedOnTreeItemEvent(this, tree, event.getItemId()));
        open(event.getClientX(), event.getClientY());
    }
41633
private static LblTree createTree(TreeWalker walker) {
		Node parent = walker.getCurrentNode();
		LblTree node = new LblTree(parent.getNodeName(), -1); // treeID = -1
		for (Node n = walker.firstChild(); n != null; n = walker.nextSibling()) {
			node.add(createTree(walker));
		}
		walker.setCurrentNode(parent);
		return node;
	}
593282
public static void expandAll(JTree tree)
    {
        int r = 0;
        while (r < tree.getRowCount())
        {
            tree.expandRow(r);
            r++;
        }
    }
577224
protected function _expandPaths()
    {
        $expanded = array();
        foreach ($this->_paths as $path) {
            if (preg_match('/[*.\[\]]/', $path)) {
                $tree = $this->_generateTree($path);
                $expanded = array_merge($expanded, $tree);
            } else {
                $expanded[] = $path;
            }
        }
        $this->_paths = $expanded;
    }