public boolean isAncestorOf(IJavaElement e){
  IJavaElement parentElement=e.getParent();
  while (parentElement != null && !parentElement.equals(this)) {
    parentElement=parentElement.getParent();
  }
  return parentElement != null;
}

public boolean isAncestorOf ( IJavaElement e ) { IJavaElement parentElement = e . getParent ( ) ; while ( parentElement != null && ! parentElement . equals ( this ) ) { parentElement = parentElement . getParent ( ) ; } return parentElement != null ; }
returns true if this element is an ancestor of the given element , otherwise false .
