merge from trunk
[taxeditor.git] / eu.etaxonomy.taxeditor.navigation / src / main / java / eu / etaxonomy / taxeditor / navigation / navigator / operation / DeleteOperation.java
index 49c6f77961672d07d05f151e50074920e8933c19..d1737c14e031f03117b88f8bdb0989d60d33edef 100644 (file)
@@ -17,9 +17,9 @@ import org.eclipse.core.commands.operations.IUndoContext;
 import org.eclipse.core.runtime.IAdaptable;
 import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.handlers.HandlerUtil;
 
-import eu.etaxonomy.cdm.api.application.CdmApplicationController;
-import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
 import eu.etaxonomy.cdm.api.service.IClassificationService;
 import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
@@ -32,6 +32,8 @@ import eu.etaxonomy.cdm.model.common.ITreeNode;
 import eu.etaxonomy.cdm.model.taxon.Classification;
 import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.cdm.api.application.CdmApplicationController;
+import eu.etaxonomy.cdm.api.application.ICdmApplicationConfiguration;
 import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
 import eu.etaxonomy.taxeditor.store.CdmStore;
@@ -113,16 +115,25 @@ public class DeleteOperation extends AbstractPersistentPostOperation{
                                
                        }else if(taxonNode != null && taxonNode instanceof Classification){
                                Classification taxonomicTree = (Classification) taxonNode;
-                               if(taxonomicTree.hasChildNodes()){
-                                       StoreUtil.warningDialog("Tree is not empty", this, "It is not possible to delete a Taxonomic Tree that " +
-                                                       "is not empty. Please delete included taxa first");
-                               }else{
+                               /*if(taxonomicTree.hasChildNodes()){
+                                       if(! MessageDialog.openConfirm(null, "Confirm Deletion", "The selected tree has children, do yu realy want to delete the whole tree with its children?")){
+                                               return null;
+                                       }
+                               }*/
+                               try{
+                                       CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
+                               }catch(ReferencedObjectUndeletableException e){
+                                       throw new ExecutionException(e.getMessage());
+                               }
+                                       
+                                       
+                               /*}else{
                                        try{
                                        CdmStore.getService(IClassificationService.class).delete(taxonomicTree);
                                        }catch(ReferencedObjectUndeletableException e){
                                                throw new ExecutionException(e.getMessage());
                                        }
-                               }
+                               }*/
                        } else {
                                try {
                                        service.deleteTaxonNodes(treeNodes, config);