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
.editor
.name
.operation
;
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
.api
.service
.ITaxonService
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.SynonymRelationshipType
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
23 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
24 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
25 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
26 import eu
.etaxonomy
.taxeditor
.store
.StoreUtil
;
29 * <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 SynonymRelationshipType synonymRelationshipType
;
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 super("Swap Synonym And Accepted Taxon Operation", undoContext
, taxon
, postOperationEnabled
);
54 this.synonym
= synonym
;
58 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
62 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
63 throws ExecutionException
{
67 CdmStore
.getService(ITaxonService
.class).swapSynonymAndAcceptedTaxon(synonym
, element
);
71 return postExecute(element
);
75 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
79 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
80 throws ExecutionException
{
81 // TODO Auto-generated method stub
82 return execute(monitor
, info
);
86 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
90 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
91 throws ExecutionException
{
92 StoreUtil
.error(this.getClass(), "Not yet implemented", null);