Revision d175d20f
Added by Cherian Mathew almost 9 years ago
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/CreateSynonymInHomotypicalGroupHandler.java | ||
---|---|---|
1 | 1 |
// $Id$ |
2 | 2 |
/** |
3 | 3 |
* Copyright (C) 2007 EDIT |
4 |
* European Distributed Institute of Taxonomy
|
|
4 |
* European Distributed Institute of Taxonomy |
|
5 | 5 |
* http://www.e-taxonomy.eu |
6 |
*
|
|
6 |
* |
|
7 | 7 |
* The contents of this file are subject to the Mozilla Public License Version 1.1 |
8 | 8 |
* See LICENSE.TXT at the top of this package for the full license terms. |
9 | 9 |
*/ |
... | ... | |
21 | 21 |
import org.eclipse.ui.handlers.HandlerUtil; |
22 | 22 |
|
23 | 23 |
import eu.etaxonomy.cdm.model.name.HomotypicalGroup; |
24 |
import eu.etaxonomy.cdm.model.name.TaxonNameBase;
|
|
24 |
import eu.etaxonomy.cdm.model.name.NonViralName;
|
|
25 | 25 |
import eu.etaxonomy.cdm.model.taxon.Synonym; |
26 | 26 |
import eu.etaxonomy.taxeditor.editor.EditorUtil; |
27 | 27 |
import eu.etaxonomy.taxeditor.editor.Page; |
... | ... | |
46 | 46 |
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent) |
47 | 47 |
*/ |
48 | 48 |
/** {@inheritDoc} */ |
49 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
49 |
@Override |
|
50 |
public Object execute(ExecutionEvent event) throws ExecutionException { |
|
50 | 51 |
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage( |
51 | 52 |
Page.NAME); |
52 | 53 |
ISelection menuSelection = HandlerUtil.getCurrentSelection(event); |
53 |
|
|
54 |
|
|
54 | 55 |
Object selecteObject = ((StructuredSelection) menuSelection).getFirstElement(); |
55 |
|
|
56 |
|
|
56 | 57 |
if(! (selecteObject instanceof Synonym)){ |
57 | 58 |
return null; |
58 | 59 |
} |
59 |
|
|
60 |
|
|
60 |
|
|
61 |
|
|
61 | 62 |
Synonym synonym = (Synonym) selecteObject; |
62 |
|
|
63 |
|
|
63 | 64 |
HomotypicalGroup group = synonym.getHomotypicGroup(); |
64 |
|
|
65 |
TaxonNameBase newSynonymName = ParseHandler.createEmptyName();
|
|
66 |
|
|
65 |
|
|
66 |
NonViralName newSynonymName = ParseHandler.createEmptyName();
|
|
67 |
|
|
67 | 68 |
AbstractPostOperation operation; |
68 |
|
|
69 |
|
|
69 | 70 |
try { |
70 | 71 |
operation = new CreateSynonymInExistingHomotypicalGroupOperation(event.getCommand().getName(), editor.getUndoContext(), |
71 | 72 |
editor.getTaxon(), group, newSynonymName, editor); |
... | ... | |
73 | 74 |
} catch (NotDefinedException e) { |
74 | 75 |
logger.warn("Command name not set"); |
75 | 76 |
} |
76 |
|
|
77 |
|
|
77 | 78 |
return null; |
78 | 79 |
} |
79 | 80 |
} |
Also available in: Unified diff
added cdm entitysession enabled objects to operations