Remove bulk editor for name relations from menu #5788
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 25 May 2016 12:44:18 +0000 (14:44 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 25 May 2016 12:44:31 +0000 (14:44 +0200)
 - also fix possible NPE

eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicNewObjectMenu.java
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/OpenBulkEditorContributionItem.java

index 4ee1e3318de265c427beaf5502678bab94f3f137..f8210b3350d1c7fc5af5a12148de16d6daec6834 100644 (file)
@@ -10,6 +10,7 @@
 
 package eu.etaxonomy.taxeditor.bulkeditor.command;
 
+import java.util.Collections;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -32,8 +33,6 @@ import eu.etaxonomy.taxeditor.bulkeditor.IBulkEditorConstants;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 
 /**
- * <p>DynamicNewObjectMenu class.</p>
- *
  * @author n.hoffmann
  * @created 17.04.2009
  * @version 1.0
@@ -44,9 +43,7 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
 
        private final IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
        private Map<Object, String> classLabelPairs;
-       /* (non-Javadoc)
-        * @see org.eclipse.ui.actions.CompoundContributionItem#getContributionItems()
-        */
+
        /** {@inheritDoc} */
        @Override
        protected IContributionItem[] getContributionItems() {
@@ -99,10 +96,12 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
 
                        if(input instanceof AbstractBulkEditorInput){
                                IEntityCreator<?> entityCreator = ((AbstractBulkEditorInput) input).getEntityCreator();
-                               return entityCreator.getKeyLabelPairs();
+                               if(entityCreator!=null){
+                                   return entityCreator.getKeyLabelPairs();
+                               }
                        }
                }
 
-               return null;
+               return Collections.EMPTY_MAP;
        }
 }
index 8b6ad8db4b7757abd81a064e46267f66a53b0c55..f783a0965fc4234f27580b5f223d7b3a97ebcec1 100644 (file)
@@ -74,7 +74,6 @@ public class OpenBulkEditorContributionItem extends CompoundContributionItem {
         String groupName = "test";
         contributionItems.add(new Separator(groupName));
         contributionItems.add(BulkEditorInputType.NAME.createContributionItem());
-        contributionItems.add(BulkEditorInputType.NAME_RELATIONSHIP.createContributionItem());
         contributionItems.add(BulkEditorInputType.TAXON.createContributionItem());
         contributionItems.add(new Separator(groupName));
         contributionItems.add(BulkEditorInputType.OCCURRENCE.createContributionItem());