+++ /dev/null
-// $Id$
-/**
-* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.commands.common.NotDefinedException;
-
-import eu.etaxonomy.cdm.model.taxon.Synonym;
-import eu.etaxonomy.cdm.model.taxon.Taxon;
-import eu.etaxonomy.cdm.model.taxon.TaxonRelationshipType;
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.editor.Page;
-import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeConceptRelationshipTypeOperation;
-import eu.etaxonomy.taxeditor.editor.name.operation.ChangeSynonymToMisapplicationOperation;
-import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
-
-/**
- * <p>ChangeToMisapplicationHandler class.</p>
- *
- * @author n.hoffmann
- * @created 21.04.2009
- * @version 1.0
- */
-public class ChangeToMisapplicationHandler extends AbstractHandler implements
- IHandler {
- private static final Logger logger = Logger
- .getLogger(ChangeToMisapplicationHandler.class);
-
- /* (non-Javadoc)
- * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
- */
- /** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
- TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
- Page.NAME);
-
- Object selectedElement = EditorUtil.getSelection(event).getFirstElement();
-
- AbstractPostOperation operation = null;
- try {
- if(selectedElement instanceof Taxon){
- operation = new ChangeConceptRelationshipTypeOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), (Taxon) selectedElement, TaxonRelationshipType.MISAPPLIED_NAME_FOR(), editor);
- }
- if(selectedElement instanceof Synonym){
- operation = new ChangeSynonymToMisapplicationOperation(event.getCommand().getName(),
- editor.getUndoContext(), editor.getTaxon(), (Synonym) selectedElement, editor);
- }
-
- EditorUtil.executeOperation(operation);
- } catch (NotDefinedException e) {
- logger.warn("Command name not set");
- }
-
- return null;
- }
-}