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
.apache
.log4j
.Logger
;
13 import org
.eclipse
.core
.commands
.AbstractHandler
;
14 import org
.eclipse
.core
.commands
.ExecutionEvent
;
15 import org
.eclipse
.core
.commands
.ExecutionException
;
16 import org
.eclipse
.core
.commands
.common
.NotDefinedException
;
18 import eu
.etaxonomy
.cdm
.model
.name
.TaxonName
;
19 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
20 import eu
.etaxonomy
.cdm
.model
.taxon
.TaxonRelationshipType
;
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
.view
.concept
.operation
.CreateConceptRelationOperation
;
25 import eu
.etaxonomy
.taxeditor
.operation
.AbstractPostOperation
;
26 import eu
.etaxonomy
.taxeditor
.parser
.ParseHandler
;
29 * <p>CreateMisapplicationHandler class.</p>
34 public class CreateMisapplicationHandler
extends AbstractHandler
{
35 private static final Logger logger
= Logger
36 .getLogger(CreateMisapplicationHandler
.class);
39 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
40 TaxonNameEditor editor
= (TaxonNameEditor
) EditorUtil
.getActiveEditorPage(
44 TaxonName conceptName
= ParseHandler
.createEmptyName();
45 Taxon concept
= Taxon
.NewInstance(conceptName
, null);
47 TaxonRelationshipType type
= TaxonRelationshipType
.MISAPPLIED_NAME_FOR();
49 AbstractPostOperation
<?
> operation
;
51 operation
= new CreateConceptRelationOperation(event
.getCommand().getName(),
52 editor
.getUndoContext(), editor
.getTaxon(), concept
, type
, editor
);
53 EditorUtil
.executeOperation(operation
);
54 } catch (NotDefinedException e
) {
55 logger
.warn("Command name not set"); //$NON-NLS-1$