protected IType getParentType(IType type) {
   ITypeHierarchy hierarchy = getHierarchy();
   if (hierarchy != null) {
     return hierarchy.getSuperclass(type);
   }
   return null;
 }
 private int getDepth(ITypeHierarchy hierarchy, IType input) {
   int count = 0;
   IType superType = hierarchy.getSuperclass(input);
   while (superType != null) {
     count++;
     superType = hierarchy.getSuperclass(superType);
   }
   return count;
 }
 public int getExpandLevel() {
   ITypeHierarchy hierarchy = getHierarchy();
   if (hierarchy != null) {
     IType input = hierarchy.getType();
     if (input != null) {
       return getDepth(hierarchy, input) + 2;
     } else {
       return 5;
     }
   }
   return 2;
 }
  /* (non-Javadoc)
   * @see org.eclipse.wst.jsdt.internal.corext.callhierarchy.IImplementorFinder#findImplementingTypes(org.eclipse.wst.jsdt.core.IType, org.eclipse.core.runtime.IProgressMonitor)
   */
  public Collection findImplementingTypes(IType type, IProgressMonitor progressMonitor) {
    ITypeHierarchy typeHierarchy;

    try {
      typeHierarchy = type.newTypeHierarchy(progressMonitor);

      IType[] implementingTypes = typeHierarchy.getAllClasses();
      HashSet result = new HashSet(Arrays.asList(implementingTypes));

      return result;
    } catch (JavaScriptModelException e) {
      JavaScriptPlugin.log(e);
    }

    return null;
  }
 /*
  * @see TypeHierarchyContentProvider.getTypesInHierarchy
  */
 protected final void getTypesInHierarchy(IType type, List res) {
   ITypeHierarchy hierarchy = getHierarchy();
   if (hierarchy != null) {
     IType[] types = hierarchy.getSubclasses(type);
     if (isObject(type)) {
       for (int i = 0; i < types.length; i++) {
         IType curr = types[i];
         res.add(curr);
       }
     } else {
       for (int i = 0; i < types.length; i++) {
         res.add(types[i]);
       }
     }
   }
 }
 /* (non-Javadoc)
  * @see org.eclipse.wst.jsdt.internal.ui.typehierarchy.TypeHierarchyContentProvider#getRootTypes(java.util.List)
  */
 protected final void getRootTypes(List res) {
   ITypeHierarchy hierarchy = getHierarchy();
   if (hierarchy != null) {
     IType input = hierarchy.getType();
     if (input == null) {
       IType[] classes = hierarchy.getRootClasses();
       for (int i = 0; i < classes.length; i++) {
         res.add(classes[i]);
       }
     } else {
       IType[] roots = hierarchy.getRootClasses();
       for (int i = 0; i < roots.length; i++) {
         if (isObject(roots[i])) {
           res.add(roots[i]);
           return;
         }
       }
       res.addAll(Arrays.asList(roots)); // something wrong with the hierarchy
     }
   }
 }