Merge branch 'develop' into LibrAlign
[taxeditor.git] / eu.etaxonomy.taxeditor.bulkeditor / src / main / java / eu / etaxonomy / taxeditor / bulkeditor / command / DynamicNewObjectMenu.java
index bc9116b1effd63741e4a27e19f5af75ab9e0632d..ecc6c898c0c89fbc3a5299fa57fc5d48296cd99d 100644 (file)
@@ -1,4 +1,3 @@
-// $Id$
 /**
 * Copyright (C) 2007 EDIT
 * European Distributed Institute of Taxonomy
@@ -10,6 +9,7 @@
 
 package eu.etaxonomy.taxeditor.bulkeditor.command;
 
+import java.util.Collections;
 import java.util.Map;
 
 import org.apache.log4j.Logger;
@@ -32,8 +32,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
@@ -42,11 +40,9 @@ public class DynamicNewObjectMenu extends CompoundContributionItem {
        private static final Logger logger = Logger
                        .getLogger(DynamicNewObjectMenu.class);
 
-       private IHandlerService handlerService = (IHandlerService) BulkEditorUtil.getService(IHandlerService.class);
+       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 +95,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;
        }
 }