- added option for deep delete (with children) to DerivateEditor
authorPatric Plitzner <p.plitzner@bgbm.org>
Tue, 16 Dec 2014 09:34:24 +0000 (09:34 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Tue, 16 Dec 2014 09:34:24 +0000 (09:34 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/handler/DeleteDerivateHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/operation/DeleteDerivateOperation.java

index 69b9b20d54d9973673faedf942bc29d8c82d53bd..70de10d2d8028ae54ca6bb3178e4265d39da7734 100644 (file)
@@ -69,7 +69,9 @@ public class DeleteDerivateHandler extends AbstractHandler {
                             label += " "+DerivateLabelProvider.getDerivateText(value, conversationHolder);
                         }
                         SpecimenDeleteConfigurator config = new SpecimenDeleteConfigurator();
-                        config.setDeleteChildren(false);
+                        boolean deepDelete = event.getCommand().getId().equals("eu.etaxonomy.taxeditor.editor.derivate.deepDelete");
+                        config.setDeleteChildren(deepDelete);
+                        config.setDeleteMolecularData(deepDelete);
                         DeleteDerivateOperation deleteDerivateOperation = new DeleteDerivateOperation(label, undoContext, (CdmBase) value, postOperationEnabled, config);
                         AbstractUtility.executeOperation(deleteDerivateOperation);
                     }
index 678b43e4089603b4e7453f52ef5abb1e6562b858..78afd7c0a319cda57508054eb130834b2f7ad8ac 100644 (file)
@@ -60,7 +60,12 @@ public class DeleteDerivateOperation extends AbstractPostOperation<CdmBase> {
     @Override
     public IStatus execute(IProgressMonitor monitor, IAdaptable info) throws ExecutionException {
         if(getPostOperationEnabled() instanceof ISaveablePart){
-            if(!MessagingUtils.confirmDialog("Confirm deletion", "Do you really want to delete the selected element?")){
+            String confirmationQuestion = "Do you really want to delete the selected element";
+            if(deleteConfigurator.isDeleteChildren()){
+                confirmationQuestion += " and its children";
+            }
+            confirmationQuestion += "?";
+            if(!MessagingUtils.confirmDialog("Confirm deletion", confirmationQuestion)){
                 return Status.CANCEL_STATUS;
             }
             if(((ISaveablePart) getPostOperationEnabled()).isDirty()){