Add "Open in..." to referencing objects view
authorPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 5 Apr 2016 13:28:57 +0000 (15:28 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Tue, 5 Apr 2016 13:28:57 +0000 (15:28 +0200)
 - fix potential NPE

eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerChooser.java

index 2fbde553ffd633de3c2ab3158e686e510b23b313..4869f718f708c836da07c80dcedda77ff609f01a 100644 (file)
                class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
                id="eu.etaxonomy.taxeditor.referencingObjectsView.cdmViewerContextMenu">
          </dynamic>
+         <separator
+               name="eu.etaxonomy.taxeditor.bulkeditor.separator1">
+         </separator>
       </menuContribution>
       <menuContribution
             allPopups="false"
index 330301f8f7bc2ed7a62873640c8f3467139663cb..63017075fb5d5dbea3636b5b5378112a1fcc0317 100644 (file)
@@ -32,7 +32,6 @@ import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.commands.ICommandService;
 import org.eclipse.ui.handlers.IHandlerService;
 
 import eu.etaxonomy.cdm.model.common.ICdmBase;
@@ -91,13 +90,19 @@ public class CdmViewerChooser extends PopupDialog implements ISelectionChangedLi
             String commandId = command.getId();
                        params.put(commandId+".uuid", ((ICdmBase) input).getUuid());
 
-            //build the parameterized command
-            ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, params);
+                       if(command.isEnabled()) {
+
+                           //build the parameterized command
+                           ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, params);
 
-            if(command.isEnabled()) {
                 IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
                 try {
-                    handlerService.executeCommand(pc, null);
+                    if(pc!=null){
+                        handlerService.executeCommand(pc, null);
+                    }
+                    else{
+                        handlerService.executeCommand(commandId, null);
+                    }
                 } catch (NotDefinedException nde) {
                     throw new RuntimeException("Could not find open command: " + commandId);
                 } catch (Exception exception) {