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.
9 package eu
.etaxonomy
.taxeditor
.editor
.view
.descriptive
.operation
;
11 import org
.eclipse
.core
.commands
.ExecutionException
;
12 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
13 import org
.eclipse
.core
.runtime
.IAdaptable
;
14 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
15 import org
.eclipse
.core
.runtime
.IStatus
;
17 import eu
.etaxonomy
.cdm
.api
.service
.IDescriptionService
;
18 import eu
.etaxonomy
.cdm
.model
.description
.SpecimenDescription
;
19 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
20 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
21 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
22 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
23 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 public class DeleteSpecimenDescriptionOperation
30 extends AbstractPostOperation
<SpecimenOrObservationBase
<?
>> {
32 private final SpecimenDescription description
;
34 public DeleteSpecimenDescriptionOperation(String label
,
35 IUndoContext undoContext
,
36 SpecimenDescription description
,
37 IPostOperationEnabled postOperationEnabled
,
38 ICdmEntitySessionEnabled
<SpecimenOrObservationBase
<?
>> cdmEntitySessionEnabled
) {
39 super(label
, undoContext
, description
.getDescribedSpecimenOrObservation(), postOperationEnabled
, cdmEntitySessionEnabled
);
40 this.description
= description
;
44 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
45 throws ExecutionException
{
48 CdmStore
.getService(IDescriptionService
.class).deleteDescription(description
.getUuid());
50 return postExecute(description
);
54 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
55 throws ExecutionException
{
56 return execute(monitor
, info
);
60 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
61 throws ExecutionException
{
63 element
.addDescription(description
);
65 return postExecute(null);