4 package eu
.etaxonomy
.taxeditor
.handlers
;
6 import org
.apache
.log4j
.Logger
;
7 import org
.eclipse
.core
.commands
.AbstractHandler
;
8 import org
.eclipse
.core
.commands
.ExecutionEvent
;
9 import org
.eclipse
.core
.commands
.ExecutionException
;
10 import org
.eclipse
.core
.commands
.IHandler
;
11 import org
.eclipse
.core
.commands
.common
.NotDefinedException
;
12 import org
.eclipse
.core
.commands
.operations
.IUndoableOperation
;
14 import eu
.etaxonomy
.cdm
.model
.taxon
.Taxon
;
15 import eu
.etaxonomy
.taxeditor
.controller
.EditorController
;
16 import eu
.etaxonomy
.taxeditor
.controller
.GlobalController
;
17 import eu
.etaxonomy
.taxeditor
.operations
.name
.CreateMisappliedNameOperation
;
23 public class CreateMisappliedNameHandler
extends AbstractHandler
implements IHandler
{
24 private static final Logger logger
= Logger
25 .getLogger(CreateMisappliedNameHandler
.class);
28 * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
30 public Object
execute(ExecutionEvent event
) throws ExecutionException
{
31 Taxon taxon
= EditorController
.getActiveEditor().getTaxon();
33 IUndoableOperation operation
;
35 operation
= new CreateMisappliedNameOperation(event
.getCommand().getName(),
36 EditorController
.getUndoContext(taxon
), taxon
);
37 GlobalController
.executeOperation(operation
);
38 } catch (NotDefinedException e
) {
39 logger
.warn("Command name not set");