1 package eu
.etaxonomy
.taxeditor
.navigation
.navigator
;
3 import java
.util
.Comparator
;
5 import org
.eclipse
.jface
.viewers
.Viewer
;
6 import org
.eclipse
.jface
.viewers
.ViewerComparator
;
8 import eu
.etaxonomy
.cdm
.model
.taxon
.Classification
;
9 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNaturalComparator
;
10 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
12 public class TaxonNodeNavigatorComparator
extends ViewerComparator
{
14 Comparator
<TaxonNode
> comparator
;
16 public TaxonNodeNavigatorComparator(Comparator
<TaxonNode
> comparator
){
18 this.comparator
= comparator
;
24 public int compare(Viewer viewer
, Object e1
, Object e2
){
25 if ((e1
instanceof Classification
&& e2
instanceof Classification
) ){
26 return ((Classification
)e1
).getTitleCache().compareTo(((Classification
)e2
).getTitleCache());
28 if (((TaxonNode
)e1
).getTaxon() == null && ((TaxonNode
)e2
).getTaxon() == null){
29 String title1
= ((TaxonNode
)e1
).getClassification().getTitleCache();
30 title1
= title
== null ?
"" : title1
;
31 return title1
.compareTo(((TaxonNode
)e2
).getClassification().getTitleCache());
33 return comparator
.compare((TaxonNode
)e1
, (TaxonNode
)e2
);