TreePath (DefaultMutableTreeNode node) { DefaultMutableTreeNode parent = (DefaultMutableTreeNode)node.getParent(); if (parent != null) { IndexTreePathState state = new IndexTreePathState(TreeUtil.getPathFromRoot(node)); removeNodeFromParent(node); if (parent.isLeaf()) { return removeNode(parent); } return state.getRestoredPath(); } return null; }