fixing #2685 ([LINUX] Editing concept relationships does not work under linux)
authorAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 23 Feb 2012 13:52:27 +0000 (13:52 +0000)
committerAndreas Kohlbecker <a.kohlbecker@bgbm.org>
Thu, 23 Feb 2012 13:52:27 +0000 (13:52 +0000)
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/handler/CreateConceptRelationHandler.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/concept/operation/CreateConceptRelationOperation.java

index 4ba5ee029d6087a31a849a90c466519bf42f4056..533d3b8865953644927411a3bbb2dc6b6c52571b 100644 (file)
 
 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;
@@ -37,7 +40,7 @@ import eu.etaxonomy.taxeditor.ui.dialog.selection.TaxonBaseSelectionDialog;
  * @version 1.0
  */
 public class CreateConceptRelationHandler extends AbstractHandler {
-
+       
        /* (non-Javadoc)
         * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
         */
@@ -48,15 +51,22 @@ public class CreateConceptRelationHandler extends AbstractHandler {
                
                Taxon taxonToBeFiltered = editor.getTaxon();
                
+               /* 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;
                
-               IWorkbenchPart activePart = HandlerUtil.getActivePart(event);
+
                IPostOperationEnabled postOperationEnabled = (activePart instanceof IPostOperationEnabled) ? (IPostOperationEnabled) activePart : null;
                
                try {
index 9b690254ba7ba7bb8769fbad1e82b35eebc4f421..29079f925e0276991adfbcecf36f166e6f77ced5 100644 (file)
@@ -71,7 +71,7 @@ public class CreateConceptRelationOperation extends AbstractPostOperation {
                if(taxonRelationshipTypeInverseContainer.isInverse()){
                        concept.addTaxonRelation(taxon, taxonRelationshipTypeInverseContainer.getType(), null, null);   
                } else {
-                       taxon.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);   
+                       taxon.addTaxonRelation(concept, taxonRelationshipTypeInverseContainer.getType(), null, null);
                }
                monitor.worked(40);