commit f3fb72fdaf40e993eeec1f606bfd88caeba06898
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Wed Sep 14 07:10:18 2016 +0200

    fix #6062 Add property tester for "Open in..." bulk editor menu items
    
     - moved isGroupEditor property test to bulk editor plugin

diff --git a/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml b/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
index 6570a9cb4..abb836ab2 100644
--- a/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
+++ b/eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
@@ -310,7 +310,6 @@
             name="%command.name.OPEN_BULK_EDITOR_FOR_TAXON_NODE">
       </command>
       <command
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity"
             id="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity"
             name="Open bulk editor for identifiable entity">
          <commandParameter
@@ -435,6 +434,24 @@
             </test>
          </with>
       </definition>
+      <definition
+            id="isBulkEditorSupported">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester.isBulkEditorSupported">
+            </test>
+         </with>
+      </definition>
+      <definition
+            id="isGroupEditor">
+         <with
+               variable="activeEditor">
+            <test
+                  property="taxeditor-bulkeditor.propertyTester.isGroupEditor">
+            </test>
+         </with>
+      </definition>
    </extension>
    <extension
          point="org.eclipse.core.expressions.propertyTesters">
@@ -452,6 +469,13 @@
             properties="isTeam, isPerson"
             type="java.lang.Object">
       </propertyTester>
+      <propertyTester
+            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
+            id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
+            namespace="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorSelectionPropertyTester"
+            properties="isBulkEditorSupported"
+            type="org.eclipse.jface.viewers.IStructuredSelection">
+      </propertyTester>
    </extension>
    <extension
          point="org.eclipse.ui.handlers">
@@ -511,6 +535,15 @@
             class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"
             commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">
       </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.bulkeditor.handler.defaultHandler.OpenBulkEditorForIdentifiableEntity"
+            commandId="eu.etaxonomy.taxeditor.bulkeditor.openBulkEditorForIdentifiableEntity">
+         <activeWhen>
+            <reference
+                  definitionId="isBulkEditorSupported">
+            </reference>
+         </activeWhen>
+      </handler>
       
    </extension>
    <extension
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java
new file mode 100644
index 000000000..8c544a737
--- /dev/null
+++ b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorSelectionPropertyTester.java
@@ -0,0 +1,27 @@
+package eu.etaxonomy.taxeditor.bulkeditor.command;
+
+import org.eclipse.core.expressions.PropertyTester;
+import org.eclipse.jface.viewers.IStructuredSelection;
+
+import eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputType;
+
+public class BulkEditorSelectionPropertyTester extends PropertyTester {
+
+    public static final String IS_BULK_EDITOR_SUPPORTED = "isBulkEditorSupported";
+    
+	@Override
+	public boolean test(Object receiver, String property, Object[] args,
+			Object expectedValue) {
+		if(IS_BULK_EDITOR_SUPPORTED.equals(property)){
+			if(receiver instanceof IStructuredSelection){
+				IStructuredSelection selection = (IStructuredSelection) receiver;
+				Object selectedElement = selection.getFirstElement();
+				if(selectedElement!=null){
+					return BulkEditorInputType.getByType(selectedElement.getClass())!=null;
+				}
+			}
+		}
+		return false;
+	}
+	
+}
diff --git a/eu.etaxonomy.taxeditor.editor/plugin.xml b/eu.etaxonomy.taxeditor.editor/plugin.xml
index e32835fb7..d44bd7718 100644
--- a/eu.etaxonomy.taxeditor.editor/plugin.xml
+++ b/eu.etaxonomy.taxeditor.editor/plugin.xml
@@ -1882,15 +1882,6 @@
             </test>
          </with>
       </definition>
-      <definition
-            id="isGroupEditor">
-         <with
-               variable="activeEditor">
-            <test
-                  property="taxeditor-bulkeditor.propertyTester.isGroupEditor">
-            </test>
-         </with>
-      </definition>
       <definition
             id="isIndividualsAssociation">
          <with
@@ -1978,13 +1969,6 @@
             properties="isMedia,isDescription,isDescriptionElement,isDeletable,isFeatureNodeContainer,isImageGallery,isTaxonEditor,isBulkEditor,isDerivateEditor, isIndividualsAssociation"
             type="org.eclipse.jface.viewers.TreeSelection">
       </propertyTester>
-      <propertyTester
-            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"
-            id="taxeditor-bulkeditor.PropertyTester"
-            namespace="taxeditor-bulkeditor.propertyTester"
-            properties="isGroupEditor"
-            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">
-      </propertyTester>
       <propertyTester
             class="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
             id="eu.etaxonomy.taxeditor.editor.handler.SpecimenPropertyTester"
