/** Removes the given node from its parent. */ public void removeNodeFromParent(MutableTreeNode node) { MutableTreeNode parent = (MutableTreeNode) node.getParent(); // Ensure that the given node has a parent if (parent == null) { throw new IllegalArgumentException("node does not have a parent"); } // Remove the node from the parent int idx = parent.getIndex(node); parent.remove(idx); // Notify listeners that the node has been removed fireTreeNodesRemoved(this, getPathToRoot(parent), new int[] {idx}, new Object[] {node}); }
public void remove(MessageStoreTreeNode node) { MutableTreeNode parent = (MutableTreeNode) node.getParent(); node.close(); parent.remove(node); getBrowserModel().nodeStructureChanged(parent); }