KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > jdt > internal > ui > typehierarchy > HierarchyViewerSorter


1 /*******************************************************************************
2  * Copyright (c) 2000, 2005 IBM Corporation and others.
3  * All rights reserved. This program and the accompanying materials
4  * are made available under the terms of the Eclipse Public License v1.0
5  * which accompanies this distribution, and is available at
6  * http://www.eclipse.org/legal/epl-v10.html
7  *
8  * Contributors:
9  * IBM Corporation - initial API and implementation
10  *******************************************************************************/

11 package org.eclipse.jdt.internal.ui.typehierarchy;
12
13 import org.eclipse.jdt.core.IType;
14 import org.eclipse.jdt.core.ITypeHierarchy;
15
16 /**
17   */

18 public class HierarchyViewerSorter extends AbstractHierarchyViewerSorter {
19         
20     private final TypeHierarchyLifeCycle fHierarchy;
21     private boolean fSortByDefiningType;
22     
23     public HierarchyViewerSorter(TypeHierarchyLifeCycle cycle) {
24         fHierarchy= cycle;
25     }
26     
27     public void setSortByDefiningType(boolean sortByDefiningType) {
28         fSortByDefiningType= sortByDefiningType;
29     }
30     
31     /* (non-Javadoc)
32      * @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#getTypeKind(org.eclipse.jdt.core.IType)
33      */

34     protected int getTypeFlags(IType type) {
35         ITypeHierarchy hierarchy= getHierarchy(type);
36         if (hierarchy != null) {
37             return fHierarchy.getHierarchy().getCachedFlags(type);
38         }
39         return 0;
40     }
41     
42     /*
43      * (non-Javadoc)
44      * @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#isSortByDefiningType()
45      */

46     public boolean isSortByDefiningType() {
47         return fSortByDefiningType;
48     }
49
50     /* (non-Javadoc)
51      * @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#isSortAlphabetically()
52      */

53     public boolean isSortAlphabetically() {
54         return true;
55     }
56
57     /* (non-Javadoc)
58      * @see org.eclipse.jdt.internal.ui.typehierarchy.AbstractHierarchyViewerSorter#getHierarchy(org.eclipse.jdt.core.IType)
59      */

60     protected ITypeHierarchy getHierarchy(IType type) {
61         return fHierarchy.getHierarchy(); // hierarchy contains all types shown
62
}
63
64 }
65
Popular Tags