public boolean equals(Object o) {
   if (o instanceof StructureViewTreeElementWrapper) {
     return Comparing.equal(
         unwrapValue(getValue()), unwrapValue(((StructureViewTreeElementWrapper) o).getValue()));
   } else if (o instanceof StructureViewTreeElement) {
     return Comparing.equal(unwrapValue(getValue()), ((StructureViewTreeElement) o).getValue());
   }
   return false;
 }
  private static boolean addToPath(
      AbstractTreeNode<?> rootElement,
      Object element,
      ArrayList<AbstractTreeNode> result,
      Collection<Object> processedElements) {
    Object value = rootElement.getValue();
    if (value instanceof StructureViewTreeElement) {
      value = ((StructureViewTreeElement) value).getValue();
    }
    if (!processedElements.add(value)) {
      return false;
    }

    if (Comparing.equal(value, element)) {
      result.add(0, rootElement);
      return true;
    }

    Collection<? extends AbstractTreeNode> children = rootElement.getChildren();
    for (AbstractTreeNode child : children) {
      if (addToPath(child, element, result, processedElements)) {
        result.add(0, rootElement);
        return true;
      }
    }

    return false;
  }