2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
6 * The contents of this file are subject to the Mozilla Public License Version 1.1
7 * See LICENSE.TXT at the top of this package for the full license terms.
10 package eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
.operation
;
12 import org
.eclipse
.core
.commands
.ExecutionException
;
13 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
14 import org
.eclipse
.core
.runtime
.IAdaptable
;
15 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
16 import org
.eclipse
.core
.runtime
.IStatus
;
18 import eu
.etaxonomy
.cdm
.api
.service
.IDescriptionService
;
19 import eu
.etaxonomy
.cdm
.model
.description
.TaxonDescription
;
20 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
21 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
22 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 * <p>DeleteTaxonDescriptionOperation class.</p>
33 public class DeleteTaxonDescriptionOperation
extends AbstractPostTaxonOperation
{
35 private final TaxonDescription description
;
38 * <p>Constructor for DeleteTaxonDescriptionOperation.</p>
40 * @param label a {@link java.lang.String} object.
41 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
42 * @param description a {@link eu.etaxonomy.cdm.model.description.TaxonDescription} object.
43 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
45 public DeleteTaxonDescriptionOperation(String label
,
46 IUndoContext undoContext
,
47 TaxonDescription description
,
48 IPostOperationEnabled postOperationEnabled
,
49 ICdmEntitySessionEnabled cdmEntitySessionEnabled
) {
50 super(label
, undoContext
, postOperationEnabled
, cdmEntitySessionEnabled
);
52 this.description
= description
;
53 element
= description
.getTaxon();
57 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
61 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
62 throws ExecutionException
{
65 if (description
!= null){
66 CdmStore
.getService(IDescriptionService
.class).deleteDescription(description
.getUuid());
67 return postExecute(description
);
74 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
78 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
79 throws ExecutionException
{
80 return execute(monitor
, info
);
84 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
88 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
89 throws ExecutionException
{
91 element
.addDescription(description
);
93 return postExecute(null);