-/**\r
-* Copyright (C) 2007 EDIT\r
-* European Distributed Institute of Taxonomy \r
-* http://www.e-taxonomy.eu\r
-* \r
-* The contents of this file are subject to the Mozilla Public License Version 1.1\r
-* See LICENSE.TXT at the top of this package for the full license terms.\r
-*/\r
-\r
-package eu.etaxonomy.taxeditor.operations;\r
-\r
-import org.eclipse.core.commands.ExecutionException;\r
-import org.eclipse.core.commands.operations.IUndoContext;\r
-import org.eclipse.core.runtime.IAdaptable;\r
-import org.eclipse.core.runtime.IProgressMonitor;\r
-import org.eclipse.core.runtime.IStatus;\r
-\r
-import eu.etaxonomy.cdm.model.reference.ReferenceBase;\r
-import eu.etaxonomy.cdm.model.taxon.Taxon;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;\r
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;\r
-\r
-/**\r
- * @author p.ciardelli\r
- * @created 16.01.2009\r
- * @version 1.0\r
- */\r
-public class DeleteMisapplicationOperation extends AbstractPostOperation {\r
- \r
- private Taxon misapplication;\r
-\r
- private ReferenceBase<?> citation;\r
-\r
- private String microcitation;\r
-\r
- public DeleteMisapplicationOperation(String label, IUndoContext undoContext,\r
- Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {\r
- super(label, undoContext, taxon, postOperationEnabled);\r
- \r
- this.misapplication = misapplication;\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus execute(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
-\r
- // Find misapplication relation, save citation information\r
- for (TaxonRelationship relationship : taxon.getTaxonRelations()) {\r
- if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())\r
- && relationship.getFromTaxon().equals(misapplication)) {\r
- citation = relationship.getCitation();\r
- microcitation = relationship.getCitationMicroReference();\r
- }\r
- }\r
- monitor.worked(20);\r
- \r
- // Remove misapplied name relation from taxon\r
- taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());\r
- monitor.worked(40);\r
-\r
- return postExecute(null);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus redo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- return execute(monitor, info);\r
- }\r
-\r
- /* (non-Javadoc)\r
- * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)\r
- */\r
- @Override\r
- public IStatus undo(IProgressMonitor monitor, IAdaptable info)\r
- throws ExecutionException {\r
- \r
- taxon.addMisappliedName(misapplication, citation, microcitation);\r
- \r
- return postExecute(misapplication);\r
- }\r
-}\r
+/**
+* Copyright (C) 2007 EDIT
+* 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.
+*/
+
+package eu.etaxonomy.taxeditor.operations;
+
+import org.eclipse.core.commands.ExecutionException;
+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 eu.etaxonomy.cdm.model.reference.ReferenceBase;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationship;
+import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
+
+/**
+ * <p>DeleteMisapplicationOperation class.</p>
+ *
+ * @author p.ciardelli
+ * @created 16.01.2009
+ * @version 1.0
+ */
+public class DeleteMisapplicationOperation extends AbstractPostOperation {
+
+ private Taxon misapplication;
+
+ private ReferenceBase<?> citation;
+
+ private String microcitation;
+
+ /**
+ * <p>Constructor for DeleteMisapplicationOperation.</p>
+ *
+ * @param label a {@link java.lang.String} object.
+ * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
+ * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param misapplication a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
+ * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
+ */
+ public DeleteMisapplicationOperation(String label, IUndoContext undoContext,
+ Taxon taxon, Taxon misapplication, IPostOperationEnabled postOperationEnabled) {
+ super(label, undoContext, taxon, postOperationEnabled);
+
+ this.misapplication = misapplication;
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus execute(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ // Find misapplication relation, save citation information
+ for (TaxonRelationship relationship : taxon.getTaxonRelations()) {
+ if (relationship.getType().equals(TaxonRelationshipType.MISAPPLIED_NAME_FOR())
+ && relationship.getFromTaxon().equals(misapplication)) {
+ citation = relationship.getCitation();
+ microcitation = relationship.getCitationMicroReference();
+ }
+ }
+ monitor.worked(20);
+
+ // Remove misapplied name relation from taxon
+ taxon.removeTaxon(misapplication, TaxonRelationshipType.MISAPPLIED_NAME_FOR());
+ monitor.worked(40);
+
+ return postExecute(null);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus redo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+ return execute(monitor, info);
+ }
+
+ /* (non-Javadoc)
+ * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
+ */
+ /** {@inheritDoc} */
+ @Override
+ public IStatus undo(IProgressMonitor monitor, IAdaptable info)
+ throws ExecutionException {
+
+ taxon.addMisappliedName(misapplication, citation, microcitation);
+
+ return postExecute(misapplication);
+ }
+}