Merge branch 'release/3.12.0'
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / view / descriptive / operation / DeleteDescriptionElementOperation.java
index aad1362d5cac90b53bc190b52da28e483a4e2272..0c5ded96a98fc79da8af76b361dd185c23175a6a 100644 (file)
@@ -1,8 +1,8 @@
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
-* 
+*
 * The contents of this file are subject to the Mozilla Public License Version 1.1
 * See LICENSE.TXT at the top of this package for the full license terms.
 */
@@ -17,9 +17,10 @@ import org.eclipse.core.runtime.IStatus;
 
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptionElementBase;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
 import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
-import eu.etaxonomy.taxeditor.store.StoreUtil;
+import eu.etaxonomy.taxeditor.session.ICdmEntitySessionEnabled;
 
 /**
  * <p>DeleteDescriptionElementOperation class.</p>
@@ -28,9 +29,9 @@ import eu.etaxonomy.taxeditor.store.StoreUtil;
  * @created 05.02.2009
  * @version 1.0
  */
-public class DeleteDescriptionElementOperation extends AbstractPostOperation {
-       
-       private DescriptionElementBase element;
+public class DeleteDescriptionElementOperation extends AbstractPostTaxonOperation {
+
+       private final DescriptionElementBase element;
        private DescriptionBase description = null;
 
        /**
@@ -42,9 +43,10 @@ public class DeleteDescriptionElementOperation extends AbstractPostOperation {
         * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
         */
        public DeleteDescriptionElementOperation(String label, IUndoContext undoContext,
-                       DescriptionElementBase element, IPostOperationEnabled postOperationEnabled) {
-               super(label, undoContext, postOperationEnabled);
-               
+                       DescriptionElementBase element, IPostOperationEnabled postOperationEnabled,
+                       ICdmEntitySessionEnabled cdmEntitySessionEnabled) {
+               super(label, undoContext, postOperationEnabled, cdmEntitySessionEnabled);
+
                this.element = element;
        }
 
@@ -55,14 +57,14 @@ public class DeleteDescriptionElementOperation extends AbstractPostOperation {
        @Override
        public IStatus execute(IProgressMonitor monitor, IAdaptable info)
                        throws ExecutionException {
-               
+
                description = element.getInDescription();
-               
+
                monitor.worked(20);
-               
+
                // Remove element from description
                if (description == null) {
-                       StoreUtil.error(this.getClass(), "Couldn't find element's description!", null);
+                       MessagingUtils.error(this.getClass(), "Couldn't find element's description!", null);
                } else {
                        description.removeElement(element);
                }
@@ -91,7 +93,7 @@ public class DeleteDescriptionElementOperation extends AbstractPostOperation {
                        throws ExecutionException {
 
                description.addElement(element);
-               
+
                return postExecute(element);
        }
 }