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