3 * Copyright (C) 2007 EDIT
4 * European Distributed Institute of Taxonomy
5 * http://www.e-taxonomy.eu
7 * The contents of this file are subject to the Mozilla Public License Version 1.1
8 * See LICENSE.TXT at the top of this package for the full license terms.
11 package eu
.etaxonomy
.taxeditor
.operations
;
13 import org
.eclipse
.core
.commands
.ExecutionException
;
14 import org
.eclipse
.core
.commands
.operations
.IUndoContext
;
15 import org
.eclipse
.core
.runtime
.IAdaptable
;
16 import org
.eclipse
.core
.runtime
.IProgressMonitor
;
17 import org
.eclipse
.core
.runtime
.IStatus
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
22 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
23 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
26 * <p>SwapSynonymAndAcceptedOperation class.</p>
32 public class SwapSynonymAndAcceptedOperation
extends AbstractPostOperation
{
34 private Synonym synonym
;
35 // TODO store the old relationship for undo reasons
36 private SynonymRelationshipType synonymRelationshipType
;
39 * <p>Constructor for SwapSynonymAndAcceptedOperation.</p>
41 * @param label a {@link java.lang.String} object.
42 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
43 * @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
44 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
45 * @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
47 public SwapSynonymAndAcceptedOperation(String label
, IUndoContext undoContext
,
48 Taxon taxon
, Synonym synonym
, IPostOperationEnabled postOperationEnabled
) {
49 super("Swap Synonym And Accepted Taxon Operation", undoContext
, taxon
, postOperationEnabled
);
51 this.synonym
= synonym
;
55 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
59 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
60 throws ExecutionException
{
64 CdmStore
.getTaxonService().swapSynonymAndAcceptedTaxon(synonym
, taxon
);
68 return postExecute(taxon
);
72 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
76 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
77 throws ExecutionException
{
78 // TODO Auto-generated method stub
79 return execute(monitor
, info
);
83 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
87 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
88 throws ExecutionException
{
89 StoreUtil
.error(this.getClass(), "Not yet implemented", null);