1
|
// $Id$
|
2
|
/**
|
3
|
* Copyright (C) 2007 EDIT
|
4
|
* European Distributed Institute of Taxonomy
|
5
|
* http://www.e-taxonomy.eu
|
6
|
*
|
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.
|
9
|
*/
|
10
|
|
11
|
package eu.etaxonomy.taxeditor.editor.name.operation;
|
12
|
|
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;
|
18
|
|
19
|
import eu.etaxonomy.cdm.api.conversation.IConversationEnabled;
|
20
|
import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
|
21
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
22
|
import eu.etaxonomy.cdm.model.taxon.TaxonNode;
|
23
|
import eu.etaxonomy.taxeditor.operation.AbstractPersistentPostOperation;
|
24
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
25
|
import eu.etaxonomy.taxeditor.store.CdmStore;
|
26
|
|
27
|
/**
|
28
|
* <p>ChangeAcceptedTaxonToSynonymOperation class.</p>
|
29
|
*
|
30
|
* @author n.hoffmann
|
31
|
* @created Jan 4, 2010
|
32
|
* @version 1.0
|
33
|
*/
|
34
|
public class ChangeAcceptedTaxonToSynonymOperation extends
|
35
|
AbstractPersistentPostOperation {
|
36
|
|
37
|
private TaxonNode newAcceptedTaxonNode;
|
38
|
|
39
|
private TaxonNode oldTaxonNode;
|
40
|
|
41
|
/**
|
42
|
* <p>Constructor for ChangeAcceptedTaxonToSynonymOperation.</p>
|
43
|
*
|
44
|
* @param label a {@link java.lang.String} object.
|
45
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
46
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
47
|
* @param oldTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
|
48
|
* @param newAcceptedTaxonNode a {@link eu.etaxonomy.cdm.model.taxon.TaxonNode} object.
|
49
|
* @param conversationEnabled a {@link eu.etaxonomy.cdm.api.conversation.IConversationEnabled} object.
|
50
|
*/
|
51
|
public ChangeAcceptedTaxonToSynonymOperation(String label,
|
52
|
IUndoContext undoContext, TaxonNode oldTaxonNode, TaxonNode newAcceptedTaxonNode,
|
53
|
IPostOperationEnabled postOperationEnabled, IConversationEnabled conversationEnabled) {
|
54
|
super(label, undoContext, oldTaxonNode, postOperationEnabled, conversationEnabled);
|
55
|
this.oldTaxonNode = oldTaxonNode;
|
56
|
this.newAcceptedTaxonNode = newAcceptedTaxonNode;
|
57
|
}
|
58
|
|
59
|
|
60
|
/* (non-Javadoc)
|
61
|
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
62
|
*/
|
63
|
/** {@inheritDoc} */
|
64
|
@Override
|
65
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
66
|
throws ExecutionException {
|
67
|
|
68
|
monitor.worked(20);
|
69
|
bind();
|
70
|
Synonym synonym = CdmStore.getService(ITaxonNodeService.class).makeTaxonNodeASynonymOfAnotherTaxonNode(oldTaxonNode, newAcceptedTaxonNode, null, null, null);
|
71
|
monitor.worked(40);
|
72
|
|
73
|
return postExecute(synonym);
|
74
|
}
|
75
|
|
76
|
/* (non-Javadoc)
|
77
|
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
78
|
*/
|
79
|
/** {@inheritDoc} */
|
80
|
@Override
|
81
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
82
|
throws ExecutionException {
|
83
|
// TODO Auto-generated method stub
|
84
|
return null;
|
85
|
}
|
86
|
|
87
|
/* (non-Javadoc)
|
88
|
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
89
|
*/
|
90
|
/** {@inheritDoc} */
|
91
|
@Override
|
92
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
93
|
throws ExecutionException {
|
94
|
// TODO Auto-generated method stub
|
95
|
return null;
|
96
|
}
|
97
|
}
|