-
- IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
- if (workspaceUndoContext == null) {
- logger.error("Workspace undo context is null. DND operation cancelled");
- return Status.CANCEL_STATUS;
- }
-
- AbstractPostOperation operation = new MoveTaxonOperation
- ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator);
- NavigationUtil.executeOperation(operation);
+ if (!PreferencesUtil.getSortNodesNaturally()){
+ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled");
+ return Status.CANCEL_STATUS;
+ }
+
+ AbstractPostOperation operation = new MoveTaxonOperation
+ ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator, true);
+ NavigationUtil.executeOperation(operation);
+
+ logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+ return Status.OK_STATUS;
+ }else{
+ String[] buttonLables = {"Parent", "Predecessor", "Cancel"};
+ MessageDialog dialog = new MessageDialog(null, "Target node", null, "Do you want to use the target node as parent or do you want to move the taxon below the target.", MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
+ dialog.open();
+ int returnCode = dialog.getReturnCode();
+ if (returnCode == 0){
+ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled");
+ return Status.CANCEL_STATUS;
+ }
+
+ AbstractPostOperation operation = new MoveTaxonOperation
+ ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator, true);
+ NavigationUtil.executeOperation(operation);
+
+ logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
+ return Status.OK_STATUS;
+ }else if (returnCode == 1){
+ IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
+ if (workspaceUndoContext == null) {
+ logger.error("Workspace undo context is null. DND operation cancelled");
+ return Status.CANCEL_STATUS;
+ }