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
.SpecimenDescription
;
20 import eu
.etaxonomy
.cdm
.model
.occurrence
.SpecimenOrObservationBase
;
21 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
22 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
23 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
32 public class DeleteSpecimenDescriptionOperation
extends AbstractPostOperation
<SpecimenOrObservationBase
<?
>> {
34 private final SpecimenDescription description
;
36 public DeleteSpecimenDescriptionOperation(String label
,
37 IUndoContext undoContext
,
38 SpecimenDescription description
,
39 IPostOperationEnabled postOperationEnabled
,
40 ICdmEntitySessionEnabled cdmEntitySessionEnabled
) {
41 super(label
, undoContext
, description
.getDescribedSpecimenOrObservation(), postOperationEnabled
, cdmEntitySessionEnabled
);
42 this.description
= description
;
46 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
50 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
51 throws ExecutionException
{
54 element
.removeDescription(description
);
56 CdmStore
.getService(IDescriptionService
.class).delete(description
);
58 return postExecute(description
);
62 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
67 throws ExecutionException
{
68 return execute(monitor
, info
);
72 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
77 throws ExecutionException
{
79 element
.addDescription(description
);
81 return postExecute(null);