Project

General

Profile

Download (2.67 KB) Statistics
| Branch: | Tag: | Revision:
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.taxon.Synonym;
19
import eu.etaxonomy.cdm.model.taxon.Taxon;
20
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation;
21

    
22
/**
23
 * <p>ChangeSynonymToHomotypicalGroupBasionymOperation class.</p>
24
 *
25
 * @author p.ciardelli
26
 * @created 14.01.2009
27
 * @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym
28
 */
29
@Deprecated
30
public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostTaxonOperation {
31

    
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.getUuid());
45

    
46
		this.synonym = synonym;
47
	}
48

    
49
	@Override
50
	public IStatus execute(IProgressMonitor monitor, IAdaptable info)
51
			throws ExecutionException {
52

    
53
		monitor.worked(20);
54
//		// Get basionym for synonyms homotypic group
55
//		homotypicGroup = synonym.getHomotypicGroup();
56
//		TaxonNameBase basionym = homotypicGroup.getBasionym();
57
//
58
//		// Check if synonym is already basionym
59
//		if(basionym != null && basionym.equals(synonym.getName())){
60
//			return Status.OK_STATUS;
61
//		}
62

    
63
		// TODO replace w method from cdmlib
64
		// FIXME this is also old code: reimplement
65
//		CdmUtil.setGroupBasionym(synonym.getName());
66
		monitor.worked(40);
67

    
68
		return postExecute(synonym);
69
	}
70

    
71
	@Override
72
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
73
			throws ExecutionException {
74
		return execute(monitor, info);
75
	}
76

    
77
	@Override
78
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
79
			throws ExecutionException {
80
		// TODO replace w method from cdmlib
81
		// FIXME this is also old code: reimplement
82
//		CdmUtil.removeGroupBasionym(synonym.getName());
83

    
84
		return postExecute(synonym);
85
	}
86
}
(7-7/15)