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
.conversation
.IConversationEnabled
;
20 import eu
.etaxonomy
.cdm
.api
.service
.ITaxonNodeService
;
21 import eu
.etaxonomy
.cdm
.api
.service
.exception
.DataChangeNoRollbackException
;
22 import eu
.etaxonomy
.cdm
.model
.taxon
.Synonym
;
23 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonNode
;
24 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPersistentPostOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.IPostOperationEnabled
;
26 import eu
.etaxonomy
.taxeditor
.store
.CdmStore
;
29 * <p>ChangeAcceptedTaxonToSynonymOperation class.</p>
32 * @created Jan 4, 2010
35 public class ChangeAcceptedTaxonToSynonymOperation
extends
36 AbstractPersistentPostOperation
{
38 private TaxonNode newAcceptedTaxonNode
;
40 private TaxonNode oldTaxonNode
;
43 * <p>Constructor for ChangeAcceptedTaxonToSynonymOperation.</p>
45 * @param label a {@link java.lang.String} object.
46 * @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
47 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
48 * @param oldTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
49 * @param newAcceptedTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
50 * @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
52 public ChangeAcceptedTaxonToSynonymOperation(String label
,
53 IUndoContext undoContext
, TaxonNode oldTaxonNode
, TaxonNode newAcceptedTaxonNode
,
54 IPostOperationEnabled postOperationEnabled
, IConversationEnabled conversationEnabled
) {
55 super(label
, undoContext
, oldTaxonNode
, postOperationEnabled
, conversationEnabled
);
56 this.oldTaxonNode
= oldTaxonNode
;
57 this.newAcceptedTaxonNode
= newAcceptedTaxonNode
;
62 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
66 public IStatus
execute(IProgressMonitor monitor
, IAdaptable info
)
67 throws ExecutionException
{
71 Synonym synonym
= null;
73 synonym
= CdmStore
.getService(ITaxonNodeService
.class).makeTaxonNodeASynonymOfAnotherTaxonNode(oldTaxonNode
, newAcceptedTaxonNode
, null, null, null);
74 } catch (DataChangeNoRollbackException e
) {
75 // TODO Auto-generated catch block
80 return postExecute(synonym
);
84 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
88 public IStatus
redo(IProgressMonitor monitor
, IAdaptable info
)
89 throws ExecutionException
{
90 // TODO Auto-generated method stub
95 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
99 public IStatus
undo(IProgressMonitor monitor
, IAdaptable info
)
100 throws ExecutionException
{
101 // TODO Auto-generated method stub