KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > eclipse > ui > internal > navigator > resources > workbench > ResourceComparator


1 /*******************************************************************************
2  * Copyright (c) 2005, 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  
12 package org.eclipse.ui.internal.navigator.resources.workbench;
13
14 import java.util.Comparator JavaDoc;
15
16 import org.eclipse.ui.views.navigator.ResourceSorter;
17
18 /**
19  *
20  * <p>
21  * <strong>EXPERIMENTAL</strong>. This class or interface has been added as
22  * part of a work in progress. There is a guarantee neither that this API will
23  * work nor that it will remain the same. Please do not use this API without
24  * consulting with the Platform/UI team.
25  * </p>
26  * @since 3.2
27  *
28  */

29 class ResourceComparator implements Comparator JavaDoc {
30
31     private ResourceSorter sorter = new ResourceSorter(ResourceSorter.NAME);
32
33     /**
34      * The following compare will sort items based on their type (in the order of: ROOT, PROJECT,
35      * FOLDER, FILE) and then based on their String representation
36      *
37      * (non-Javadoc)
38      *
39      * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
40      */

41     public int compare(Object JavaDoc o1, Object JavaDoc o2) {
42         return this.sorter.compare(null, o1, o2);
43     }
44
45     /*
46      * (non-Javadoc)
47      *
48      * @see java.util.Comparator#equals(java.lang.Object)
49      */

50     public boolean equals(Object JavaDoc obj) {
51
52         return obj instanceof ResourceComparator;
53     }
54 }
55
Popular Tags