Proposed implementation for Bug 322898 - [hierarchy] revive and adjust tradition type hierarchy for OT/J.
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
index 8bb076e..a8c3888 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/META-INF/MANIFEST.MF
@@ -20,7 +20,8 @@
org.eclipse.ui.workbench.texteditor,
org.eclipse.compare,
org.eclipse.ui.views,
- org.eclipse.core.filesystem
+ org.eclipse.core.filesystem,
+ org.eclipse.objectteams.otdt
Bundle-Vendor: %providerName
Bundle-RequiredExecutionEnvironment: J2SE-1.5
Bundle-ActivationPolicy: lazy
diff --git a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/typehierarchy/TypeHierarchyViewAdaptor.java b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/typehierarchy/TypeHierarchyViewAdaptor.java
index 238337f..bfb6d3e 100644
--- a/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/typehierarchy/TypeHierarchyViewAdaptor.java
+++ b/plugins/org.eclipse.objectteams.otdt.jdt.ui/src/org/eclipse/objectteams/otdt/internal/ui/typehierarchy/TypeHierarchyViewAdaptor.java
@@ -21,6 +21,7 @@
package org.eclipse.objectteams.otdt.internal.ui.typehierarchy;
import java.util.ArrayList;
+import java.util.Arrays;
import java.util.List;
import org.eclipse.jdt.core.IType;
@@ -31,9 +32,11 @@
import org.eclipse.objectteams.otdt.core.IRoleType;
import org.eclipse.objectteams.otdt.core.OTModelManager;
import org.eclipse.objectteams.otdt.core.TypeHelper;
+import org.eclipse.objectteams.otdt.core.hierarchy.OTTypeHierarchies;
import org.eclipse.objectteams.otdt.ui.Util;
import base org.eclipse.jdt.internal.ui.typehierarchy.MethodsContentProvider;
+import base org.eclipse.jdt.internal.ui.typehierarchy.TraditionalHierarchyViewer.TraditionalHierarchyContentProvider;
/**
* This team adapts the type hierarchy to show method mappings.
@@ -116,4 +119,31 @@
boolean getShowInheritedMethods() -> boolean isShowInheritedMethods();
}
+
+ /**
+ * This role ensures that the traditional hierarchy view applies super class linearization
+ * for all classes above the focus type.
+ */
+ protected class TraditionalHierarchyView playedBy TraditionalHierarchyContentProvider
+ {
+ @SuppressWarnings("decapsulation")
+ ITypeHierarchy getHierarchy() -> ITypeHierarchy getHierarchy();
+
+ @SuppressWarnings("unchecked")
+ getTypesInHierarchy <- replace getTypesInHierarchy;
+
+ @SuppressWarnings("basecall")
+ callin void getTypesInHierarchy(IType type, List<IType> res) {
+ ITypeHierarchy hierarchy = getHierarchy();
+ IType[] typesAboveFocus = null;
+ if (hierarchy != null) {
+ typesAboveFocus = OTTypeHierarchies.getInstance().getTypesInTraditionalHierarchy(hierarchy, type);
+ if (typesAboveFocus != null) {
+ res.addAll(Arrays.asList(typesAboveFocus));
+ return;
+ }
+ }
+ base.getTypesInHierarchy(type, res);
+ }
+ }
}