(no commit message)
authorKatja Luther <k.luther@bgbm.org>
Thu, 12 Mar 2015 11:47:03 +0000 (11:47 +0000)
committerKatja Luther <k.luther@bgbm.org>
Thu, 12 Mar 2015 11:47:03 +0000 (11:47 +0000)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/TreeNodeDropAdapterAssistant.java

index d78128c6e3d8c3d0d3b692c3ddd20abfc648694b..a8828cbc7d8a167f6e4cab1a6c89e7debf29c6c9 100644 (file)
@@ -25,6 +25,7 @@ import org.eclipse.jface.viewers.ISelection;
 import org.eclipse.jface.viewers.TreeSelection;
 import org.eclipse.swt.dnd.DropTargetEvent;
 import org.eclipse.swt.dnd.TransferData;
+import org.eclipse.ui.handlers.HandlerUtil;
 import org.eclipse.ui.navigator.CommonDropAdapter;
 import org.eclipse.ui.navigator.CommonDropAdapterAssistant;
 
@@ -66,7 +67,13 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
                        Set<TaxonNode> taxonNodes = getSelectedTaxa();
                        ITaxonTreeNode targetTreeNode = (ITaxonTreeNode) target;
                        if(taxonNodes != null) {
-                return moveTaxon(taxonNodes, targetTreeNode);
+                               if (taxonNodes.size() == 1){
+                                       return moveTaxon(taxonNodes.iterator().next(), targetTreeNode);
+                               } else{
+                                       if( MessageDialog.openConfirm(null, "Moving taxon", "The operation move accepted taxon to other parent is available only for a single taxon.")){
+                                               return null;
+                                       }
+                               }
             }
                }
 
@@ -150,7 +157,7 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
         * @param parentTaxon
         * @return
         */
-       private IStatus moveTaxon(Set<TaxonNode> taxonNodes, ITaxonTreeNode targetITaxonTreeNode) {
+       private IStatus moveTaxon(TaxonNode taxonNode, ITaxonTreeNode targetITaxonTreeNode) {
 
                TaxonNavigator taxonNavigator;
                taxonNavigator = (TaxonNavigator) NavigationUtil.showView(TaxonNavigator.ID);
@@ -194,9 +201,9 @@ public class TreeNodeDropAdapterAssistant extends CommonDropAdapterAssistant imp
                }
 
                AbstractPostOperation operation = new MoveTaxonOperation
-                               ("Move Taxon", workspaceUndoContext, taxonNodes, targetITaxonTreeNode, this, taxonNavigator);
+                               ("Move Taxon", workspaceUndoContext, taxonNode, targetITaxonTreeNode, this, taxonNavigator);
                NavigationUtil.executeOperation(operation);
-
+               
                logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
                return Status.OK_STATUS;
        }