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
.name
.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
.ITaxonService
;
19 import eu
.etaxonomy
.cdm
.api
.service
.UpdateResult
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymType
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
23 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
24 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 import eu
.etaxonomy
.taxeditor
.session
.ICdmEntitySessionEnabled
;
27 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
30 * <p>SwapSynonymAndAcceptedOperation class.</p>
35 public class SwapSynonymAndAcceptedOperation
extends AbstractPostTaxonOperation
{
37 private final Synonym synonym
;
38 // TODO store the old relationship for undo reasons
39 private SynonymType synonymType
;
42 * <p>Constructor for SwapSynonymAndAcceptedOperation.</p>
44 * @param label a {@link java.lang.String} object.
45 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
46 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
47 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
48 * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
50 public SwapSynonymAndAcceptedOperation(String label
, IUndoContext undoContext
,
51 Taxon taxon
, Synonym synonym
, IPostOperationEnabled postOperationEnabled
,
52 ICdmEntitySessionEnabled cdmEntitySessionEnabled
) {
53 super("Swap Synonym And Accepted Taxon Operation", undoContext
, taxon
, postOperationEnabled
, cdmEntitySessionEnabled
);
55 this.synonym
= synonym
;
60 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
61 throws ExecutionException
{
65 UpdateResult result
= CdmStore
.getService(ITaxonService
.class).swapSynonymAndAcceptedTaxon(synonym
.getUuid(), element
.getUuid());
69 return postExecute(element
);
74 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
75 throws ExecutionException
{
76 // TODO Auto-generated method stub
77 return execute(monitor
, info
);
82 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
83 throws ExecutionException
{
84 MessagingUtils
.error(this.getClass(), "Not yet implemented", null);