code: public static TreeElement getRoot(TreeElement node)
      {
          TreeElement parentNode = node.getParent();
          while (parentNode != null) {
              node = parentNode;
              parentNode = node.getParent();
          }
          return node;
      }
docs: Gets the root node of this tree.
  @param node The TreeElement to start from
  @return The root node