1 11 package org.eclipse.jdt.internal.ui.typehierarchy; 12 13 import java.util.List ; 14 15 import org.eclipse.swt.widgets.Composite; 16 17 import org.eclipse.ui.IWorkbenchPart; 18 19 import org.eclipse.jdt.core.IType; 20 import org.eclipse.jdt.core.ITypeHierarchy; 21 22 27 public class SuperTypeHierarchyViewer extends TypeHierarchyViewer { 28 29 public SuperTypeHierarchyViewer(Composite parent, TypeHierarchyLifeCycle lifeCycle, IWorkbenchPart part) { 30 super(parent, new SuperTypeHierarchyContentProvider(lifeCycle), lifeCycle, part); 31 } 32 33 36 public String getTitle() { 37 if (isMethodFiltering()) { 38 return TypeHierarchyMessages.SuperTypeHierarchyViewer_filtered_title; 39 } else { 40 return TypeHierarchyMessages.SuperTypeHierarchyViewer_title; 41 } 42 } 43 44 47 public void updateContent(boolean expand) { 48 getTree().setRedraw(false); 49 refresh(); 50 if (expand) { 51 expandAll(); 52 } 53 getTree().setRedraw(true); 54 } 55 56 59 public static class SuperTypeHierarchyContentProvider extends TypeHierarchyContentProvider { 60 public SuperTypeHierarchyContentProvider(TypeHierarchyLifeCycle lifeCycle) { 61 super(lifeCycle); 62 } 63 64 protected final void getTypesInHierarchy(IType type, List res) { 65 ITypeHierarchy hierarchy= getHierarchy(); 66 if (hierarchy != null) { 67 IType[] types= hierarchy.getSupertypes(type); 68 for (int i= 0; i < types.length; i++) { 69 res.add(types[i]); 70 } 71 } 72 } 73 74 protected IType getParentType(IType type) { 75 return null; 77 } 78 79 } 80 81 } 82 | Popular Tags |