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
.model
.taxon
.Synonym
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
22 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostTaxonOperation
;
23 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
24 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
27 * <p>ChangeSynonymToConceptOperation class.</p>
34 public class ChangeSynonymToConceptOperation
extends AbstractPostTaxonOperation
{
35 private final Synonym synonym
;
36 private final TaxonRelationshipType taxonRelationshipType
;
39 * <p>Constructor for ChangeSynonymToConceptOperation.</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 synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
45 * @param taxonRelationshipType a {@link eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType} object.
46 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
48 public ChangeSynonymToConceptOperation(String label
,
49 IUndoContext undoContext
, Taxon taxon
, Synonym synonym
, TaxonRelationshipType taxonRelationshipType
, IPostOperationEnabled postOperationEnabled
) {
50 super(label
, undoContext
, taxon
, postOperationEnabled
);
52 this.taxonRelationshipType
= taxonRelationshipType
;
53 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
{
65 // // Get name from synonym
66 // TaxonNameBase<?, ?> synonymName = synonym.getName();
68 // // remove synonym from taxon
69 // taxon.removeSynonym(synonym);
71 // // Create a taxon with synonym name
72 // Taxon fromTaxon = Taxon.NewInstance(synonymName, null);
74 // // Add taxon relation
75 // fromTaxon.addTaxonRelation(taxon, taxonRelationshipType, null, null);
78 Taxon fromTaxon
= CdmStore
.getService(ITaxonService
.class).changeSynonymToRelatedTaxon(synonym
, element
, taxonRelationshipType
, null, null);
81 // TaxonRelationshipType.
82 // logger.warn("Not yet implemented.");
84 return postExecute(fromTaxon
);
88 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
92 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
93 throws ExecutionException
{
98 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
102 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
103 throws ExecutionException
{