performed javacscript:fix and worked on documentation
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / operations / RemoveHomotypicalGroupBasionymOperation.java
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.name.TaxonNameBase;
19 import eu.etaxonomy.cdm.model.taxon.Taxon;
20 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
21
22 /**
23 * <p>RemoveHomotypicalGroupBasionymOperation class.</p>
24 *
25 * @author p.ciardelli
26 * @created 15.01.2009
27 * @version 1.0
28 */
29 public class RemoveHomotypicalGroupBasionymOperation extends
30 AbstractPostOperation {
31
32 private TaxonBase taxonBase;
33
34 /**
35 * <p>Constructor for RemoveHomotypicalGroupBasionymOperation.</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 taxonBase a {@link eu.etaxonomy.cdm.model.taxon.TaxonBase} object.
41 * @param postOperationEnabled a {@link eu.etaxonomy.taxeditor.operations.IPostOperationEnabled} object.
42 */
43 public RemoveHomotypicalGroupBasionymOperation(String text,
44 IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) {
45 super(text, undoContext, taxon, postOperationEnabled);
46
47 this.taxonBase = taxonBase;
48 }
49
50 /* (non-Javadoc)
51 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
52 */
53 /** {@inheritDoc} */
54 @Override
55 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
56 throws ExecutionException {
57
58 TaxonNameBase<?, ?> name = taxonBase.getName();
59 monitor.worked(20);
60
61 name.removeAsGroupsBasionym();
62 monitor.worked(40);
63
64 return postExecute(taxonBase);
65 }
66
67 /* (non-Javadoc)
68 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
69 */
70 /** {@inheritDoc} */
71 @Override
72 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
73 throws ExecutionException {
74 return execute(monitor, info);
75 }
76
77 /* (non-Javadoc)
78 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
79 */
80 /** {@inheritDoc} */
81 @Override
82 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
83 throws ExecutionException {
84 taxonBase.getName().setAsGroupsBasionym();
85
86 return postExecute(taxonBase);
87 }
88 }