Project

General

Profile

Download (1.14 KB) Statistics
| Branch: | Tag: | Revision:
1
// $Id$
2
/**
3
* Copyright (C) 2007 EDIT
4
* European Distributed Institute of Taxonomy 
5
* http://www.e-taxonomy.eu
6
* 
7
* The contents of this file are subject to the Mozilla Public License Version 1.1
8
* See LICENSE.TXT at the top of this package for the full license terms.
9
*/
10

    
11
package eu.etaxonomy.taxeditor.editor.view.descriptive;
12

    
13
import org.eclipse.jface.viewers.Viewer;
14
import org.eclipse.jface.viewers.ViewerSorter;
15

    
16
import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
17
import eu.etaxonomy.taxeditor.model.DescriptionHelper;
18

    
19
/**
20
 * @author n.hoffmann
21
 * @created Dec 2, 2010
22
 * @version 1.0
23
 */
24
public class DescriptiveViewerSorter extends ViewerSorter {
25

    
26
	/* (non-Javadoc)
27
	 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
28
	 */
29
	@Override
30
	public int compare(Viewer viewer, Object e1, Object e2) {
31
		if((e1 instanceof DescriptionElementBase) && (e2 instanceof DescriptionElementBase)){
32
			return DescriptionHelper.getLabel((DescriptionElementBase)e1).compareTo(DescriptionHelper.getLabel((DescriptionElementBase)e2));
33
		}
34
		return super.compare(viewer, e1, e2);
35
	}
36
	
37
}
(7-7/7)