// $Id$
/**
* Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy
+* 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.view.concept.handler;
-import org.apache.log4j.Level;
-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.common.NotDefinedException;
-import org.eclipse.core.expressions.IEvaluationContext;
import org.eclipse.core.runtime.Status;
import org.eclipse.swt.widgets.Event;
import org.eclipse.ui.IWorkbenchPart;
import eu.etaxonomy.taxeditor.editor.Page;
import eu.etaxonomy.taxeditor.editor.name.TaxonNameEditor;
import eu.etaxonomy.taxeditor.editor.view.concept.operation.CreateConceptRelationOperation;
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
import eu.etaxonomy.taxeditor.model.MessagingUtils;
import eu.etaxonomy.taxeditor.model.TaxonRelationshipTypeInverseContainer;
import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
* @version 1.0
*/
public class CreateConceptRelationHandler extends AbstractHandler {
-
+
/* (non-Javadoc)
* @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
*/
/** {@inheritDoc} */
- public Object execute(ExecutionEvent event) throws ExecutionException {
+ @Override
+ public Object execute(ExecutionEvent event) throws ExecutionException {
TaxonNameEditor editor = (TaxonNameEditor) EditorUtil.getActiveEditorPage(
Page.NAME);
-
+
Taxon taxonToBeFiltered = editor.getTaxon();
-
- /* we need to get the activePart before calling TaxonBaseSelectionDialog.selectTaxon(), otherwise the
+
+ /* we need to get the activePart before calling TaxonBaseSelectionDialog.selectTaxon(), otherwise the
* the variable of the parent applicationContext in event are overwritten during this method call
* this is Linux specific bugfix see: #2685 ([LINUX] Editing concept relationships does not work under linux)
*/
IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
Taxon relatedConcept = TaxonBaseSelectionDialog.selectTaxon(HandlerUtil.getActiveShell(event), editor.getConversationHolder(), taxonToBeFiltered);
-
-
+
+
if(relatedConcept == null){
return Status.CANCEL_STATUS;
}
-
+
TaxonRelationshipTypeInverseContainer typeInverseContainer = (TaxonRelationshipTypeInverseContainer) ((Event)event.getTrigger()).data;
-
+
IPostOperationEnabled postOperationEnabled = (activePart instanceof IPostOperationEnabled) ? (IPostOperationEnabled) activePart : null;
-
+
try {
- AbstractPostOperation operation = new CreateConceptRelationOperation(event.getCommand().getName(),
+ AbstractPostOperation operation = new CreateConceptRelationOperation(event.getCommand().getName(),
editor.getUndoContext(), editor.getTaxon(), relatedConcept, typeInverseContainer, postOperationEnabled);
- EditorUtil.executeOperation(operation);
+ AbstractUtility.executeOperation(operation);
} catch (NotDefinedException e) {
MessagingUtils.warn(getClass(), "Command name not set");
}
-
+
return null;
}
}