]> git.uio.no Git - ifi-stolz-refaktor.git/blob - case-study/jdt-after/ui/org/eclipse/jdt/ui/JavaElementSorter.java
Case Study: adding data and statistics
[ifi-stolz-refaktor.git] / case-study / jdt-after / ui / org / eclipse / jdt / ui / JavaElementSorter.java
1 /*******************************************************************************
2  * Copyright (c) 2000, 2011 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.ui;
12
13 import org.eclipse.jface.viewers.Viewer;
14 import org.eclipse.jface.viewers.ViewerSorter;
15
16
17 /**
18  * Sorter for Java elements. Ordered by element category, then by element name.
19  * Package fragment roots are sorted as ordered on the classpath.
20  *
21  * <p>
22  * This class may be instantiated; it is not intended to be subclassed.
23  * </p>
24  *
25  * @deprecated use {@link JavaElementComparator} instead.
26  * @since 2.0
27  *
28  * @noextend This class is not intended to be subclassed by clients.
29  */
30 public class JavaElementSorter extends ViewerSorter {
31
32         private final JavaElementComparator fComparator;
33
34         /**
35          * Constructor.
36          */
37         public JavaElementSorter() {
38                 super(null); // delay initialization of collator
39                 fComparator= new JavaElementComparator();
40         }
41
42         /**
43          * @deprecated Bug 22518. Method never used: does not override ViewerSorter#isSorterProperty(Object, String).
44          * Method could be removed, but kept for API compatibility.
45          *
46      * @param element the element
47      * @param property the property
48      * @return always <code>true</code>
49          */
50         public boolean isSorterProperty(Object element, Object property) {
51                 return true;
52         }
53
54         /*
55          * @see ViewerSorter#category
56          */
57         @Override
58         public int category(Object element) {
59                 return fComparator.category(element);
60         }
61
62         /*
63          * @see ViewerSorter#compare
64          */
65         @Override
66         public int compare(Viewer viewer, Object e1, Object e2) {
67                 return fComparator.compare(viewer, e1, e2);
68         }
69
70         /**
71          * Overrides {@link org.eclipse.jface.viewers.ViewerSorter#getCollator()}.
72          * @deprecated The method is not intended to be used by clients.
73          */
74         @Override
75         public final java.text.Collator getCollator() {
76                 // kept in for API compatibility
77                 if (collator == null) {
78                         collator= java.text.Collator.getInstance();
79                 }
80                 return collator;
81         }
82 }