void () { Enumeration<TreePath> expanded = getTree().getExpandedDescendants(getPathFor(parentNode)); TreePath[] selected = getTree().getSelectionModel().getSelectionPaths(); parentNode.removeAllChildren(); for (TreeNode each : all) { parentNode.add((MutableTreeNode)each); } nodeStructureChanged(parentNode); if (expanded != null) { while (expanded.hasMoreElements()) { expandSilently(expanded.nextElement()); } } if (selected != null) { for (TreePath each : selected) { if (!getTree().getSelectionModel().isPathSelected(each)) { addSelectionSilently(each); } } } }