eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonLinkHelper.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigator.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNavigatorDataChangeBehavior.java -text
+eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeComparator.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeContentProvider.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodeLabelProvider.java -text
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TaxonNodePropertyTester.java -text
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.jface.viewers.DoubleClickEvent;
import org.eclipse.jface.viewers.TreePath;
+import org.eclipse.jface.viewers.ViewerComparator;
import org.eclipse.ui.IMemento;
import org.eclipse.ui.IViewSite;
import org.eclipse.ui.PartInitException;
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
import eu.etaxonomy.cdm.api.service.IClassificationService;
import eu.etaxonomy.cdm.model.common.CdmBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;
import eu.etaxonomy.cdm.persistence.hibernate.CdmDataChangeMap;
import eu.etaxonomy.taxeditor.model.DataChangeBridge;
import eu.etaxonomy.taxeditor.model.IDataChangeBehavior;
/** {@inheritDoc} */
@Override
protected IAdaptable getInitialInput() {
+ TaxonComparatorSearch comparator = new TaxonComparatorSearch();
+ TaxonNodeComparator viewerComparator = new TaxonNodeComparator(comparator);
+ this.getCommonViewer().setComparator(viewerComparator);
if (CdmStore.isActive()) {
// TODO when closing and reopening the taxon navigator
// we do not preserve state. Closing the view, in contrary to
public void init(IViewSite site) throws PartInitException {
super.init(site);
init();
+
}
/**
conversation.registerForDataStoreChanges(TaxonNavigator.this);
}
CdmStore.getLoginManager().addObserver(this);
+
+
+
}
/**
* @return
*/
private TreePath createTreePathFromString(String string) {
-
+
+
List<CdmBase> pathList = new ArrayList<CdmBase>();
if (string.length() == 0) {
--- /dev/null
+package eu.etaxonomy.taxeditor.navigation.navigator;\r
+\r
+import java.util.Arrays;\r
+\r
+\r
+import org.eclipse.jface.viewers.Viewer;\r
+import org.eclipse.jface.viewers.ViewerComparator;\r
+\r
+\r
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonComparatorSearch;\r
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;\r
+\r
+public class TaxonNodeComparator extends ViewerComparator{\r
+\r
+ \r
+ public TaxonNodeComparator(TaxonComparatorSearch comparator) {\r
+ super(comparator);\r
+ }\r
+\r
+ @Override\r
+ public void sort(final Viewer viewer, Object[] elements) {\r
+ \r
+ TaxonBase[] nodesArray = new TaxonBase[elements.length];\r
+ if (elements.length>1){\r
+ for(int i=0; i<elements.length; i++){\r
+ nodesArray[i] = ((TaxonNode)elements[i]).getTaxon();\r
+ }\r
+ Arrays.sort(nodesArray, this.getComparator());\r
+ }\r
+ }\r
+}\r