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.editor.name.operation;
|
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.name.TaxonName;
|
19
|
import eu.etaxonomy.cdm.model.taxon.Taxon;
|
20
|
import eu.etaxonomy.cdm.model.taxon.TaxonBase;
|
21
|
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
|
22
|
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled;
|
23
|
|
24
|
/**
|
25
|
* <p>RemoveHomotypicalGroupBasionymOperation class.</p>
|
26
|
*
|
27
|
* @author p.ciardelli
|
28
|
* @created 15.01.2009
|
29
|
*/
|
30
|
public class RemoveHomotypicalGroupBasionymOperation extends
|
31
|
AbstractPostTaxonOperation {
|
32
|
|
33
|
private TaxonBase taxonBase;
|
34
|
|
35
|
/**
|
36
|
* <p>Constructor for RemoveHomotypicalGroupBasionymOperation.</p>
|
37
|
*
|
38
|
* @param text a {@link java.lang.String} object.
|
39
|
* @param undoContext a {@link org.eclipse.core.commands.operations.IUndoContext} object.
|
40
|
* @param taxon a {@link eu.etaxonomy.cdm.model.taxon.Taxon} object.
|
41
|
* @param taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
|
42
|
* @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operation.IPostOperationEnabled} object.
|
43
|
*/
|
44
|
public RemoveHomotypicalGroupBasionymOperation(String text,
|
45
|
IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
|
46
|
super(text, undoContext, taxon, postOperationEnabled);
|
47
|
|
48
|
this.taxonBase = taxonBase;
|
49
|
}
|
50
|
|
51
|
/** {@inheritDoc} */
|
52
|
@Override
|
53
|
public IStatus execute(IProgressMonitor monitor, IAdaptable info)
|
54
|
throws ExecutionException {
|
55
|
|
56
|
TaxonName name = taxonBase.getName();
|
57
|
monitor.worked(20);
|
58
|
|
59
|
name.removeAsGroupsBasionym();
|
60
|
monitor.worked(40);
|
61
|
|
62
|
return postExecute(taxonBase);
|
63
|
}
|
64
|
|
65
|
/** {@inheritDoc} */
|
66
|
@Override
|
67
|
public IStatus redo(IProgressMonitor monitor, IAdaptable info)
|
68
|
throws ExecutionException {
|
69
|
return execute(monitor, info);
|
70
|
}
|
71
|
|
72
|
/** {@inheritDoc} */
|
73
|
@Override
|
74
|
public IStatus undo(IProgressMonitor monitor, IAdaptable info)
|
75
|
throws ExecutionException {
|
76
|
taxonBase.getName().setAsGroupsBasionym();
|
77
|
|
78
|
return postExecute(taxonBase);
|
79
|
}
|
80
|
}
|