2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
;
12 import org
.eclipse
.jface
.viewers
.Viewer
;
13 import org
.eclipse
.jface
.viewers
.ViewerSorter
;
15 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
16 import eu
.etaxonomy
.taxeditor
.model
.DescriptionHelper
;
20 * @created Dec 2, 2010
23 public class DescriptiveViewerSorter
extends ViewerSorter
{
26 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
29 public int compare(Viewer viewer
, Object e1
, Object e2
) {
30 if((e1
instanceof DescriptionElementBase
) && (e2
instanceof DescriptionElementBase
)){
31 return DescriptionHelper
.getLabel((DescriptionElementBase
)e1
).compareTo(DescriptionHelper
.getLabel((DescriptionElementBase
)e2
));
33 return super.compare(viewer
, e1
, e2
);