How to insert a node into a Tree without reloading everything? Follow
i created a "tree":
var tree = new Tree(node);
now i want to insert a node "dynamically" into it via an action:
var treeModel = (DefaultTreeModel)tree.getModel();
treeModel.insertNodeInto(newChild, this, childCount);
The node is correctly inserted, i can check this by doing
The problem is that this collapses all childs and not the new one.
I also cannot do
as this collapses all nodes (parent of a parent etc).
Is there a way to tell the treeModel to insert the node and dont refresh/collapse the other childs?
Please sign in to leave a comment.
Not sure why you call "reload"?
See also `com.intellij.util.ui.tree.TreeUtil` for many utility methods dealing with trees.
If i dont call reload, the node is not appearing in the UI. I even used TreeUtils.insertNode, but it still is not appearing in the UI