1
|
/**
|
2
|
* Copyright (C) 2007 EDIT
|
3
|
* European Distributed Institute of Taxonomy
|
4
|
* http://www.e-taxonomy.eu
|
5
|
*
|
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.
|
8
|
*/
|
9
|
|
10
|
package eu.etaxonomy.taxeditor.operations;
|
11
|
|
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;
|
17
|
|
18
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
19
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
20
|
|
21
|
/**
|
22
|
* <p>ChangeSynonymToHomotypicalGroupBasionymOperation class.</p>
|
23
|
*
|
24
|
* @author p.ciardelli
|
25
|
* @created 14.01.2009
|
26
|
* @version 1.0
|
27
|
* @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym
|
28
|
*/
|
29
|
public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostOperation {
|
30
|
|
31
|
private Synonym synonym;
|
32
|
|
33
|
/**
|
34
|
* <p>Constructor for ChangeSynonymToHomotypicalGroupBasionymOperation.</p>
|
35
|
*
|
36
|
* @param text a {@link java.lang.String} object.
|
37
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
38
|
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
|
39
|
* @param synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
|
40
|
*/
|
41
|
public ChangeSynonymToHomotypicalGroupBasionymOperation(String text, IUndoContext undoContext,
|
42
|
Taxon taxon, Synonym synonym) {
|
43
|
super(text, undoContext, taxon);
|
44
|
|
45
|
this.synonym = synonym;
|
46
|
}
|
47
|
|
48
|
/* (non-Javadoc)
|
49
|
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
50
|
*/
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
54
|
throws ExecutionException {
|
55
|
|
56
|
monitor.worked(20);
|
57
|
// // Get basionym for synonyms homotypic group
|
58
|
// homotypicGroup = synonym.getHomotypicGroup();
|
59
|
// TaxonNameBase basionym = homotypicGroup.getBasionym();
|
60
|
//
|
61
|
// // Check if synonym is already basionym
|
62
|
// if(basionym != null && basionym.equals(synonym.getName())){
|
63
|
// return Status.OK_STATUS;
|
64
|
// }
|
65
|
|
66
|
// TODO replace w method from cdmlib
|
67
|
// FIXME this is also old code: reimplement
|
68
|
// CdmUtil.setGroupBasionym(synonym.getName());
|
69
|
monitor.worked(40);
|
70
|
|
71
|
return postExecute(synonym);
|
72
|
}
|
73
|
|
74
|
/* (non-Javadoc)
|
75
|
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
76
|
*/
|
77
|
/** {@inheritDoc} */
|
78
|
@Override
|
79
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
80
|
throws ExecutionException {
|
81
|
return execute(monitor, info);
|
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 replace w method from cdmlib
|
92
|
// FIXME this is also old code: reimplement
|
93
|
// CdmUtil.removeGroupBasionym(synonym.getName());
|
94
|
|
95
|
return postExecute(synonym);
|
96
|
}
|
97
|
}
|