4 package eu
.etaxonomy
.taxeditor
.navigation
.key
.polytomous
;
6 import java
.util
.Collections
;
7 import java
.util
.Comparator
;
10 import org
.eclipse
.jface
.viewers
.IStructuredContentProvider
;
11 import org
.eclipse
.jface
.viewers
.Viewer
;
17 public class PolytomousKeyContentProvider
implements IStructuredContentProvider
{
20 public void dispose() {
25 public void inputChanged(Viewer viewer
, Object oldInput
, Object newInput
) {
30 public Object
[] getElements(Object inputElement
) {
31 if(inputElement
instanceof List
){
33 Collections
.sort((List
)inputElement
,new PolytomousKeyComparator());
34 return ((List
) inputElement
).toArray();
39 public class PolytomousKeyComparator
implements Comparator
<Object
> {
42 public int compare(Object o1
, Object o2
) {
43 if(o1
== null && o2
== null) {
45 } else if (o1
== null) {
47 } else if(o2
== null) {
50 return o1
.toString().compareTo(o2
.toString());