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