package com.jetbrains.python.hierarchy.treestructures;

import com.intellij.ide.hierarchy.HierarchyNodeDescriptor;
import com.intellij.openapi.project.Project;
import com.jetbrains.python.hierarchy.PyTypeHierarchyNodeDescriptor;
import com.jetbrains.python.psi.PyClass;
import com.jetbrains.python.psi.PyUtil;
import org.jetbrains.annotations.NotNull;

/**
 * Created by IntelliJ IDEA.
 * User: Alexey.Ivanov
 * Date: Jul 31, 2009
 * Time: 6:29:00 PM
 */
public class PyTypeHierarchyTreeStructure extends PySubTypesHierarchyTreeStructure {
  private static PyTypeHierarchyNodeDescriptor buildHierarchyElement(@NotNull final PyClass cl) {
    PyTypeHierarchyNodeDescriptor descriptor = null;
    PyClass[] superClasses = PyUtil.getAllSuperClasses(cl);
    for (int i = superClasses.length - 1; i >= 0; --i) {
      final PyClass superClass = superClasses[i];
      final PyTypeHierarchyNodeDescriptor newDescriptor = new PyTypeHierarchyNodeDescriptor(descriptor, superClass, false);
      if (descriptor != null) {
        newDescriptor.setCachedChildren(new PyTypeHierarchyNodeDescriptor[]{newDescriptor});
      }
      descriptor = newDescriptor;
    }
    final PyTypeHierarchyNodeDescriptor newDescriptor = new PyTypeHierarchyNodeDescriptor(descriptor, cl, true);
    if (descriptor != null) {
      descriptor.setCachedChildren(new HierarchyNodeDescriptor[]{newDescriptor});
    }
    return newDescriptor;
  }

  protected PyTypeHierarchyTreeStructure(final Project project, final HierarchyNodeDescriptor baseDescriptor) {
    super(project, baseDescriptor);
  }

  public PyTypeHierarchyTreeStructure(@NotNull final PyClass cl) {
    super(cl.getProject(), buildHierarchyElement(cl));
    setBaseElement(myBaseDescriptor);
  }
}

@@ -357,98 +357,29 @@
 %0A * 
-Created by IntelliJ IDEA.%0A * User: Alexey.Ivanov%0A * Date: Jul 31, 2009%0A * Time: 6:29:00 PM
+@author Alexey.Ivanov
 %0A */
@@ -946,20 +946,17 @@
         
-newD
+d
 escripto

fix bug in building class hierarchy structure (PY-236)