3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
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.
11 package eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
;
13 import org
.eclipse
.jface
.viewers
.Viewer
;
14 import org
.eclipse
.jface
.viewers
.ViewerSorter
;
16 import eu
.etaxonomy
.cdm
.model
.description
.DescriptionElementBase
;
17 import eu
.etaxonomy
.taxeditor
.model
.DescriptionHelper
;
21 * @created Dec 2, 2010
24 public class DescriptiveViewerSorter
extends ViewerSorter
{
27 * @see org.eclipse.jface.viewers.ViewerComparator#compare(org.eclipse.jface.viewers.Viewer, java.lang.Object, java.lang.Object)
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
));
34 return super.compare(viewer
, e1
, e2
);