Re-implemented taxonomic tree using Common Navigator Framework.
[taxeditor.git] / taxeditor-store / src / main / java / eu / etaxonomy / taxeditor / store / operations / ChangeSynonymToHomotypicalGroupBasionymOperation.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.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.taxon.Synonym;
20 import eu.etaxonomy.cdm.model.taxon.Taxon;
21
22 /**
23 * @author p.ciardelli
24 * @created 14.01.2009
25 * @version 1.0
26 * @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym
27 */
28 public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostOperation {
29 private static final Logger logger = Logger
30 .getLogger(ChangeSynonymToHomotypicalGroupBasionymOperation.class);
31
32 private Synonym synonym;
33
34 public ChangeSynonymToHomotypicalGroupBasionymOperation(String text, IUndoContext undoContext,
35 Taxon taxon, Synonym synonym) {
36 super(text, undoContext, taxon);
37
38 this.synonym = synonym;
39 }
40
41 /* (non-Javadoc)
42 * @see org.eclipse.core.commands.operations.AbstractOperation#execute(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
43 */
44 @Override
45 public IStatus execute(IProgressMonitor monitor, IAdaptable info)
46 throws ExecutionException {
47 // // Get basionym for synonyms homotypic group
48 // homotypicGroup = synonym.getHomotypicGroup();
49 // TaxonNameBase basionym = homotypicGroup.getBasionym();
50 //
51 // // Check if synonym is already basionym
52 // if(basionym != null && basionym.equals(synonym.getName())){
53 // return Status.OK_STATUS;
54 // }
55
56 // TODO replace w method from cdmlib
57 // FIXME this is also old code: reimplement
58 // CdmUtil.setGroupBasionym(synonym.getName());
59
60 return postExecute(synonym);
61 }
62
63 /* (non-Javadoc)
64 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
65 */
66 @Override
67 public IStatus redo(IProgressMonitor monitor, IAdaptable info)
68 throws ExecutionException {
69 return execute(monitor, info);
70 }
71
72 /* (non-Javadoc)
73 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
74 */
75 @Override
76 public IStatus undo(IProgressMonitor monitor, IAdaptable info)
77 throws ExecutionException {
78 // TODO replace w method from cdmlib
79 // FIXME this is also old code: reimplement
80 // CdmUtil.removeGroupBasionym(synonym.getName());
81
82 return postExecute(synonym);
83 }
84 }