2 * Copyright (C) 2007 EDIT
3 * European Distributed Institute of Taxonomy
4 * http://www.e-taxonomy.eu
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.
10 package eu
.etaxonomy
.taxeditor
.editor
.name
.handler
;
12 import org
.eclipse
.core
.commands
.AbstractHandler
;
13 import org
.eclipse
.core
.commands
.ExecutionEvent
;
14 import org
.eclipse
.core
.commands
.ExecutionException
;
15 import org
.eclipse
.core
.commands
.IHandler
;
16 import org
.eclipse
.core
.commands
.common
.NotDefinedException
;
18 import eu
.etaxonomy
.cdm
.model
.name
.HomotypicalGroup
;
19 import eu
.etaxonomy
.cdm
.model
.name
.NonViralName
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
21 import eu
.etaxonomy
.taxeditor
.editor
.EditorUtil
;
22 import eu
.etaxonomy
.taxeditor
.editor
.Page
;
23 import eu
.etaxonomy
.taxeditor
.editor
.name
.TaxonNameEditor
;
24 import eu
.etaxonomy
.taxeditor
.editor
.name
.operation
.CreateSynonymInExistingHomotypicalGroupOperation
;
25 import eu
.etaxonomy
.taxeditor
.model
.MessagingUtils
;
26 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
27 import eu
.etaxonomy
.taxeditor
.parser
.ParseHandler
;
30 * <p>CreateHomotypicSynonymHandler class.</p>
36 public class CreateHomotypicSynonymHandler
extends AbstractHandler
implements
40 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
44 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
45 TaxonNameEditor editor
= (TaxonNameEditor
) EditorUtil
.getActiveEditorPage(
47 Taxon taxon
= editor
.getTaxon();
48 HomotypicalGroup group
= taxon
.getHomotypicGroup();
49 NonViralName newSynonymName
= ParseHandler
.createEmptyName();
51 AbstractPostOperation operation
;
53 operation
= new CreateSynonymInExistingHomotypicalGroupOperation(event
.getCommand().getName(),
54 editor
.getUndoContext(), taxon
, group
, newSynonymName
, editor
);
55 EditorUtil
.executeOperation(operation
);
56 } catch (NotDefinedException e
) {
57 MessagingUtils
.error(getClass(), e
);