Revision d175d20f
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/operation/ChangeHomotypicalGroupBasionymOperation.java | ||
---|---|---|
1 | 1 |
/** |
2 | 2 |
* Copyright (C) 2007 EDIT |
3 |
* European Distributed Institute of Taxonomy
|
|
3 |
* European Distributed Institute of Taxonomy |
|
4 | 4 |
* http://www.e-taxonomy.eu |
5 |
*
|
|
5 |
* |
|
6 | 6 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
7 | 7 |
* See LICENSE.TXT at the top of this package for the full license terms. |
8 | 8 |
*/ |
... | ... | |
16 | 16 |
import org.eclipse.core.runtime.IAdaptable; |
17 | 17 |
import org.eclipse.core.runtime.IProgressMonitor; |
18 | 18 |
import org.eclipse.core.runtime.IStatus; |
19 |
import org.eclipse.core.runtime.Status; |
|
20 | 19 |
|
21 | 20 |
import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper; |
22 |
import eu.etaxonomy.cdm.model.common.CdmBase; |
|
23 | 21 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
24 | 22 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase; |
25 | 23 |
import eu.etaxonomy.cdm.model.taxon.Taxon; |
26 | 24 |
import eu.etaxonomy.cdm.model.taxon.TaxonBase; |
27 |
import eu.etaxonomy.cdm.remote.dto.tdwg.voc.TaxonName; |
|
28 | 25 |
import eu.etaxonomy.taxeditor.operation.AbstractPostTaxonOperation; |
29 | 26 |
import eu.etaxonomy.taxeditor.operation.IPostOperationEnabled; |
30 | 27 |
|
... | ... | |
37 | 34 |
*/ |
38 | 35 |
public class ChangeHomotypicalGroupBasionymOperation extends |
39 | 36 |
AbstractPostTaxonOperation { |
40 |
private TaxonBase taxonBase; |
|
37 |
private final TaxonBase taxonBase;
|
|
41 | 38 |
|
42 | 39 |
/** |
43 | 40 |
* <p>Constructor for ChangeHomotypicalGroupBasionymOperation.</p> |
... | ... | |
51 | 48 |
public ChangeHomotypicalGroupBasionymOperation(String text, |
52 | 49 |
IUndoContext undoContext, Taxon taxon, TaxonBase taxonBase, IPostOperationEnabled postOperationEnabled) { |
53 | 50 |
super(text, undoContext, taxon, postOperationEnabled); |
54 |
|
|
51 |
|
|
55 | 52 |
this.taxonBase = taxonBase; |
56 | 53 |
} |
57 | 54 |
|
... | ... | |
62 | 59 |
@Override |
63 | 60 |
public IStatus execute(IProgressMonitor monitor, IAdaptable info) |
64 | 61 |
throws ExecutionException { |
65 |
|
|
62 |
|
|
66 | 63 |
TaxonNameBase<?, ?> name = taxonBase.getName(); |
67 |
|
|
64 |
|
|
68 | 65 |
monitor.worked(20); |
69 | 66 |
name = HibernateProxyHelper.deproxy(name, TaxonNameBase.class); |
70 | 67 |
HomotypicalGroup group = HibernateProxyHelper.deproxy(name.getHomotypicalGroup(), HomotypicalGroup.class); |
71 | 68 |
TaxonNameBase oldBasionym = name.getBasionym(); |
72 |
|
|
69 |
|
|
73 | 70 |
name.setAsGroupsBasionym(); |
74 |
|
|
71 |
|
|
75 | 72 |
monitor.worked(40); |
76 | 73 |
oldBasionym = HibernateProxyHelper.deproxy(oldBasionym, TaxonNameBase.class); |
77 | 74 |
if (oldBasionym != null){ |
... | ... | |
81 | 78 |
postExecute(oldBasionymTaxonBase); |
82 | 79 |
} |
83 | 80 |
} |
81 |
|
|
84 | 82 |
return postExecute(taxonBase); |
85 | 83 |
} |
86 | 84 |
|
... | ... | |
104 | 102 |
// TODO replace w method from cdmlib |
105 | 103 |
// FIXME this is also old code: reimplement |
106 | 104 |
// CdmUtil.setGroupBasionym(synonym.getName()); |
107 |
|
|
105 |
|
|
108 | 106 |
return postExecute(taxonBase); |
109 | 107 |
} |
110 |
|
|
111 |
|
|
108 |
|
|
109 |
|
|
112 | 110 |
} |
Also available in: Unified diff
added cdm entitysession enabled objects to operations