code: 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;
      }
docs: Returns the tree path from the given node to the root in the
  given tree model
  
  @param treeModel The tree model
  @param node The node
  @return The tree path