cleanup
authorKatja Luther <k.luther@bgbm.org>
Wed, 13 Jun 2018 13:12:30 +0000 (15:12 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 13 Jun 2018 13:12:30 +0000 (15:12 +0200)
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/TreeNodeDropAdapterE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/e4/handler/RemotingMoveTaxonNodeHandlerE4.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/operation/RemotingMoveTaxonOperation.java

index 2102acd6413ff6bb9ed147f843c727f7d957049d..7334cf7641b3acb17e4f5b1209590f61228bcc9b 100644 (file)
@@ -89,22 +89,10 @@ public class TreeNodeDropAdapterE4 extends ViewerDropAdapter implements IPostMon
                if (getCurrentTarget() instanceof TaxonNodeDto) {
                        Set<TaxonNodeDto> taxonNodes = getSelectedTaxa();
                        TaxonNodeDto targetTreeNode = (TaxonNodeDto) target;
-//                     if (targetTreeNode.getType() != null && targetTreeNode.getType().equals(Classification.class)){
-//                             targetTreeNode = ((Classification)targetTreeNode).getRootNode();
-//                             targetTreeNode = HibernateProxyHelper.deproxy(targetTreeNode, TaxonNode.class);
-//                     }
+
                        if(taxonNodes != null) {
-//                             if (taxonNodes.size() == 1){
-                                   boolean success = moveTaxon(taxonNodes, targetTreeNode);
-//                                 if (success){
-//                                     taxonNavigator.refresh();
-//                                  }
-                                       return success;
-//                             } else{
-//                                     if( MessageDialog.openConfirm(null, Messages.TreeNodeDropAdapter_MOVING, Messages.TreeNodeDropAdapter_MOVING_MESSAGE)){
-//                                             return true;
-//                                     }
-//                             }
+                           boolean success = moveTaxon(taxonNodes, targetTreeNode);
+                               return success;
             }
                }
                return false;
@@ -201,16 +189,7 @@ public class TreeNodeDropAdapterE4 extends ViewerDropAdapter implements IPostMon
         }
         IUndoContext workspaceUndoContext = taxonNavigator.getUndoContext();
          int movingTypeInt = 0;
-               if (!PreferencesUtil.getSortNodesNaturally()){
-//                     if (workspaceUndoContext == null) {
-//                             logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
-//                             return false;
-//                     }
-//                     result =CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 0);
-//
-//                     logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
-//                     return true;
-               }else{
+               if (PreferencesUtil.getSortNodesNaturally()){
                        String[] buttonLables = {TREE_NODE_DROP_ADAPTER_CHILD, TREE_NODE_DROP_ADAPTER_BEHIND,TREE_NODE_DROP_ADAPTER_CANCEL};
                        MessageDialog dialog = new MessageDialog(null, TARGET_NODE, null, DO_YOU_WANT_TO_MOVE_THE_TAXONNODE_AS_CHILD_OR_BEHIND_THE_TARGET_NODE, MessageDialog.QUESTION_WITH_CANCEL, buttonLables, 0);
                        dialog.open();
@@ -222,37 +201,14 @@ public class TreeNodeDropAdapterE4 extends ViewerDropAdapter implements IPostMon
                                        return false;
                                }
 
-//                             result = CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 0);
-//
-//                             logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
-//                             return true;
                        }else if (returnCode == 1){
                                if (workspaceUndoContext == null) {
                                        logger.error("Workspace undo context is null. DND operation cancelled"); //$NON-NLS-1$
                                        return false;
                                }
-
                                movingTypeInt = 2;
-//                             CdmStore.getService(ITaxonNodeService.class).moveTaxonNodes(uuids,targetITaxonTreeNode.getUuid(), 2);
-//                             logger.info("Moved taxa to new parent " + targetITaxonTreeNode); //$NON-NLS-1$
-//                             return true;
-                       }
-//                     } else if (returnCode == 2){
-//                IUndoContext workspaceUndoContext = NavigationUtil.getWorkbenchUndoContext();
-//                if (workspaceUndoContext == null) {
-//                    logger.error("Workspace undo context is null. DND operation cancelled");
-//                    return false;
-//                }
-//                TaxonNode targetNode = (TaxonNode) targetITaxonTreeNode;
-//
-//                AbstractPostOperation operation = new MoveTaxonOperation
-//                        ("Move Taxon", workspaceUndoContext, uuids, targetNode, this, taxonNavigator, MovingType.BEHIND);
-//                NavigationUtil.executeOperation(operation);
-//
-//                logger.info("Moved taxa to new parent " + targetITaxonTreeNode);
-//                return true;
-//            }
-                               else{
+
+                       } else {
                                return false;
                        }
 
index d49c235d8888763223a4c043b51a2e551cec0fef..8cccd5bbf6ff5121a0da5ad5cbb33331420fc2e7 100644 (file)
@@ -58,13 +58,6 @@ public class RemotingMoveTaxonNodeHandlerE4 extends RemotingCdmHandlerE4 {
             Shell shell,
             MPart activePart,
             MHandledMenuItem menuItem) {
-        // check that only a single taxon tree node has been selected
-//        if(selection.size() > 1) {
-//            return new Status(IStatus.ERROR,
-//                    "unknown", //$NON-NLS-1$
-//                    TaxonNavigatorLabels.SINGLE_TAXON_SELECTION_MESSAGE);
-//        }
-
         // check for no taxon tree node selected
         if(selection.size() == 0) {
             return new Status(IStatus.ERROR,
@@ -100,7 +93,6 @@ public class RemotingMoveTaxonNodeHandlerE4 extends RemotingCdmHandlerE4 {
 
 
             parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
-//                    new ConversationHolderMock(),
                     Messages.RemotingMoveTaxonNodeHandler_CHOOSE_TAXON,
                     oldTaxonNodeUUIDs,
                     null,
@@ -116,7 +108,6 @@ public class RemotingMoveTaxonNodeHandlerE4 extends RemotingCdmHandlerE4 {
             }
         } else {
             parentTaxonNode = TaxonNodeSelectionDialog.select(shell,
-//                    new ConversationHolderMock(),
                     Messages.RemotingMoveTaxonNodeHandler_CHOOSE_PARENT,
                     oldTaxonNodeUUIDs,
                     null,
index a4dec1456c5f45ba9151d4804a511dec619a1982..848adf09437b02c6a45a720ef1849a26d5188f1c 100644 (file)
@@ -55,54 +55,12 @@ public class RemotingMoveTaxonOperation extends RemotingCdmUpdateOperation imple
 
     }
 
-//    public RemotingMoveTaxonOperation(Object source,
-//            boolean async,
-//            List<TaxonNode> taxonNodeToMove,
-//            TaxonNode newParentTreeNode,
-//            MovingType moveToParentNode) {
-//        super(LABEL, Action.Update, source,async);
-//
-//        taxonNodesToMoveUuid=taxonNodeToMove;
-//        this.newParentTreeNodeUuid = newParentTreeNode.getUuid();
-//        this.moveToParentNode = moveToParentNode;
-//    }
-
-
-//    /**
-//     * @param source
-//     * @param async
-//     * @param uuids
-//     * @param uuid
-//     * @param child
-//     */
-//    public RemotingMoveTaxonOperation(Object source, boolean async, Set<UUID> uuids, UUID uuid,
-//            MovingType child) {
-//        super(LABEL, Action.Update, source,async);
-//        this.taxonNodesToMoveUuid = uuids;
-//        this.newParentTreeNodeUuid = uuid;
-//        this.moveToParentNode = child;
-//    }
-
     /* (non-Javadoc)
      * @see eu.etaxonomy.taxeditor.operation.RemotingCdmUpdateOperation#doUpdateExecute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
      */
     @Override
     protected UpdateResult doUpdateExecute(IProgressMonitor monitor, IAdaptable info) throws Exception {
-//        switch (this.moveToParentNode) {
-//            case CHILD:
-//                return CdmApplicationState.getService(ITaxonNodeService.class).moveTaxonNodes(taxonNodesToMoveUuid,
-//                        newParentTreeNodeUuid, 0);
-//            case BEHIND:
-//                runMoniteredOperation();
-//                return updateResult;
-//             default:
-//                    UpdateResult result = new UpdateResult();
-//                    result.setAbort();
-//                    result.addException(new Exception("The moving type is invalid.")); //$NON-NLS-1$
-//                    return result;
-//        }
         runMoniteredOperation();
-//        taxonNavigator.refresh();
         return updateResult;
     }
 
@@ -140,7 +98,7 @@ public class RemotingMoveTaxonOperation extends RemotingCdmUpdateOperation imple
                     }
                 });
         }
-//        monitor.done();
+
 
     }