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.store.operations;
|
11
|
|
12
|
import org.apache.log4j.Logger;
|
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.model.name.TaxonNameBase;
|
20
|
import eu.etaxonomy.cdm.model.taxon.Synonym;
|
21
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
22
|
import eu.etaxonomy.taxeditor.store.model.SynonymUtil;
|
23
|
|
24
|
/**
|
25
|
* @author p.ciardelli
|
26
|
* @created 15.01.2009
|
27
|
* @version 1.0
|
28
|
*/
|
29
|
public class ChangeHomotypicalGroupBasionymOperation extends
|
30
|
AbstractPostOperation {
|
31
|
private static final Logger logger = Logger
|
32
|
.getLogger(ChangeHomotypicalGroupBasionymOperation.class);
|
33
|
private Synonym synonym;
|
34
|
|
35
|
public ChangeHomotypicalGroupBasionymOperation(String text,
|
36
|
IUndoContext undoContext, Taxon taxon, Synonym synonym, IPostOperationEnabled postOperationEnabled) {
|
37
|
super(text, undoContext, taxon, postOperationEnabled);
|
38
|
|
39
|
this.synonym = synonym;
|
40
|
}
|
41
|
|
42
|
/* (non-Javadoc)
|
43
|
* @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
44
|
*/
|
45
|
@Override
|
46
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
47
|
throws ExecutionException {
|
48
|
|
49
|
TaxonNameBase oldSynonymName = synonym.getName();
|
50
|
// TODO replace w method from cdmlib
|
51
|
SynonymUtil.setGroupBasionym(oldSynonymName);
|
52
|
|
53
|
return postExecute(synonym);
|
54
|
}
|
55
|
|
56
|
/* (non-Javadoc)
|
57
|
* @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
58
|
*/
|
59
|
@Override
|
60
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
61
|
throws ExecutionException {
|
62
|
return execute(monitor, info);
|
63
|
}
|
64
|
|
65
|
/* (non-Javadoc)
|
66
|
* @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
|
67
|
*/
|
68
|
@Override
|
69
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
70
|
throws ExecutionException {
|
71
|
// TODO replace w method from cdmlib
|
72
|
// FIXME this is also old code: reimplement
|
73
|
// CdmUtil.setGroupBasionym(synonym.getName());
|
74
|
|
75
|
return postExecute(synonym);
|
76
|
}
|
77
|
}
|