1 package eu
.etaxonomy
.taxeditor
.editor
.view
.uses
.operation
;
3 import org
.eclipse
.core
.commands
.ExecutionException
;
4 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
5 import org
.eclipse
.core
.runtime
.IAdaptable
;
6 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
7 import org
.eclipse
.core
.runtime
.IStatus
;
9 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
10 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
11 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
13 public class DeleteTaxonUseOperation
extends AbstractPostOperation
{
15 private TaxonDescription description
;
18 * <p>Constructor for DeleteTaxonDescriptionOperation.</p>
20 * @param label a {@link java.lang.String} object.
21 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
22 * @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object.
23 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
25 public DeleteTaxonUseOperation(String label
, IUndoContext undoContext
,
26 TaxonDescription description
, IPostOperationEnabled postOperationEnabled
) {
27 super(label
, undoContext
, postOperationEnabled
);
29 this.description
= description
;
30 taxon
= description
.getTaxon();
34 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
38 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
39 throws ExecutionException
{
42 taxon
.removeDescription(description
);
45 return postExecute(description
);
49 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
53 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
54 throws ExecutionException
{
55 return execute(monitor
, info
);
59 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
63 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
64 throws ExecutionException
{
66 taxon
.addDescription(description
);
68 return postExecute(null);