KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > model > WorkbenchViewerComparator


1 /*******************************************************************************
2  * Copyright (c) 2006 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.ui.model;
12
13 import java.util.Comparator JavaDoc;
14
15 import org.eclipse.jface.viewers.IBasicPropertyConstants;
16 import org.eclipse.jface.viewers.ViewerComparator;
17
18 /**
19  *
20  * A viewer comparator that sorts elements with registered workbench adapters by
21  * their text property. Note that capitalization differences are not considered
22  * by this sorter, so a > B > c
23  *
24  * @see IWorkbenchAdapter
25  * @since 3.3
26  */

27 public class WorkbenchViewerComparator extends ViewerComparator {
28
29     /**
30      * Creates a workbench viewer sorter using the default collator.
31      */

32     public WorkbenchViewerComparator() {
33         super();
34     }
35
36     /**
37      * Creates a workbench viewer sorter using the given collator.
38      *
39      * @param comparator the comparator to use to sort strings
40      */

41     public WorkbenchViewerComparator(Comparator JavaDoc comparator) {
42         super(comparator);
43     }
44
45     /* (non-Javadoc)
46      * Method declared on ViewerComparator.
47      */

48     public boolean isSorterProperty(Object JavaDoc element, String JavaDoc propertyId) {
49         return propertyId.equals(IBasicPropertyConstants.P_TEXT);
50     }
51 }
52
Popular Tags