Project

General

Profile

Download (3.26 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
 * @version 1.0
28
 * @deprecated there will be an operation to set the basionym only that automatically unsets the former basionym
29
 */
30
@Deprecated
31
public class ChangeSynonymToHomotypicalGroupBasionymOperation extends AbstractPostTaxonOperation {
32

    
33
	private Synonym synonym;
34

    
35
	/**
36
	 * <p>Constructor for ChangeSynonymToHomotypicalGroupBasionymOperation.</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 synonym a {@link eu.etaxonomy.cdm.model.taxon.Synonym} object.
42
	 */
43
	public ChangeSynonymToHomotypicalGroupBasionymOperation(String text, IUndoContext undoContext,
44
			Taxon taxon, Synonym synonym) {
45
		super(text, undoContext, taxon.getUuid());
46

    
47
		this.synonym = synonym;
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
		monitor.worked(20);
59
//		// Get basionym for synonyms homotypic group
60
//		homotypicGroup = synonym.getHomotypicGroup();
61
//		TaxonNameBase basionym = homotypicGroup.getBasionym();
62
//
63
//		// Check if synonym is already basionym
64
//		if(basionym != null && basionym.equals(synonym.getName())){
65
//			return Status.OK_STATUS;
66
//		}
67

    
68
		// TODO replace w method from cdmlib
69
		// FIXME this is also old code: reimplement
70
//		CdmUtil.setGroupBasionym(synonym.getName());
71
		monitor.worked(40);
72

    
73
		return postExecute(synonym);
74
	}
75

    
76
	/* (non-Javadoc)
77
	 * @see org.eclipse.core.commands.operations.AbstractOperation#redo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
78
	 */
79
	/** {@inheritDoc} */
80
	@Override
81
	public IStatus redo(IProgressMonitor monitor, IAdaptable info)
82
			throws ExecutionException {
83
		return execute(monitor, info);
84
	}
85

    
86
	/* (non-Javadoc)
87
	 * @see org.eclipse.core.commands.operations.AbstractOperation#undo(org.eclipse.core.runtime.IProgressMonitor, org.eclipse.core.runtime.IAdaptable)
88
	 */
89
	/** {@inheritDoc} */
90
	@Override
91
	public IStatus undo(IProgressMonitor monitor, IAdaptable info)
92
			throws ExecutionException {
93
		// TODO replace w method from cdmlib
94
		// FIXME this is also old code: reimplement
95
//		CdmUtil.removeGroupBasionym(synonym.getName());
96

    
97
		return postExecute(synonym);
98
	}
99
}
(7-7/15)