commit 1b6fc97e1609b5ec875018ec41af92649649074b
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Thu Aug 18 15:10:55 2016 +0200

    fix #5988 Add Checklist Editor to generic "Open in..." menu

diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
index e3f0fba1c..ef403bd00 100644
--- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
+++ b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
@@ -184,3 +184,4 @@ command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = Toggle link with taxon selection
 
 viewCommandMapping.viewerName.NAME_EDITOR = Name Editor
 viewCommandMapping.viewerName.SPECIMEN_EDITOR = Derivative Editor
+viewCommandMapping.viewerName.CHECKLIST_EDITOR = Checklist Editor
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
index 8c3d36882..ace0d93b8 100644
--- a/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
+++ b/eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
@@ -182,4 +182,5 @@ command.name.REMOVE_SINGLE_READ = Entferne Single-Read von Sequenz
 command.name.TOGGLE_LINK_WITH_TAXON_SELECTION = De-/Aktiviere Verknüpfung mit Taxonauswahl
 
 viewCommandMapping.viewerName.NAME_EDITOR = Namenseditor
-viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor
\ No newline at end of file
+viewCommandMapping.viewerName.SPECIMEN_EDITOR = Specimen-Editor
+viewCommandMapping.viewerName.CHECKLIST_EDITOR = Checklisten-Editor
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.editor/plugin.xml b/eu.etaxonomy.taxeditor.editor/plugin.xml
index ff2957452..0bb691ff2 100644
--- a/eu.etaxonomy.taxeditor.editor/plugin.xml
+++ b/eu.etaxonomy.taxeditor.editor/plugin.xml
@@ -1231,10 +1231,6 @@
             </with>
          </activeWhen>
       </handler>
-      <handler
-            class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
-            commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler">
-      </handler>
       <handler
             class="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
             commandId="org.eclipse.ui.edit.delete">
@@ -1305,6 +1301,25 @@
             </with>
          </activeWhen>
       </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
+            commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler">
+         <activeWhen>
+            <and>
+               <reference
+                     definitionId="isChecklistEditorEnabled">
+               </reference>
+               <or>
+                  <reference
+                        definitionId="isTaxonNode">
+                  </reference>
+                  <reference
+                        definitionId="isClassification">
+                  </reference>
+               </or>
+            </and>
+         </activeWhen>
+      </handler>
    </extension>
    <extension
          name="%extension.name"
@@ -1597,9 +1612,14 @@
             name="%command.name.34">
       </command>
        <command
-             defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistEditorHandler"
              id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"
              name="%command.name.38">
+          <commandParameter
+                id="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler.uuid"
+                name="taxonNodeUuid"
+                optional="true"
+                typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+          </commandParameter>
        </command>
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.new.category"
@@ -2008,5 +2028,10 @@
             selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
             viewerName="%viewCommandMapping.viewerName.SPECIMEN_EDITOR">
       </viewCommandMapping>
+      <viewCommandMapping
+            commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"
+            selection="eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode"
+            viewerName="%viewCommandMapping.viewerName.CHECKLIST_EDITOR">
+      </viewCommandMapping>
     </extension>
 </plugin>
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java
index cc2bbf047..0b16c16c8 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenChecklistEditorHandler.java
@@ -1,65 +1,58 @@
 package eu.etaxonomy.taxeditor.editor.handler;
 
-import org.apache.log4j.Logger;
-import org.eclipse.core.commands.AbstractHandler;
+import java.util.UUID;
+
 import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.PartInitException;
-import org.eclipse.ui.handlers.HandlerUtil;
 
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
 import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.cdm.model.taxon.ITaxonTreeNode;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.view.checklist.ChecklistEditorInput;
-import eu.etaxonomy.taxeditor.model.AbstractUtility;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
 import eu.etaxonomy.taxeditor.preference.IPreferenceKeys;
 import eu.etaxonomy.taxeditor.preference.PreferencesUtil;
+import eu.etaxonomy.taxeditor.store.CdmStore;
 
-public class OpenChecklistEditorHandler extends AbstractHandler {
+public class OpenChecklistEditorHandler extends DefaultOpenHandlerBase<ITaxonTreeNode> {
 
-    private static final Logger logger = Logger.getLogger(OpenChecklistEditorHandler.class);
+	@Override
+	protected ITaxonTreeNode getEntity(UUID uuid) {
+		ITaxonTreeNode taxonTreeNode = CdmStore.getService(ITaxonNodeService.class).load(uuid);
+		if(taxonTreeNode==null){
+			taxonTreeNode = CdmStore.getService(IClassificationService.class).load(uuid);
+		}
+		return taxonTreeNode;
+	}
 
-    /*
-     * (non-Javadoc)
-     *
-     * @see
-     * org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.
-     * ExecutionEvent)
-     */
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-        boolean isChecklistEditorActivated = PreferencesUtil.getPreferenceStore().getBoolean(
-                IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE);
-        if (isChecklistEditorActivated) {
-            ISelection currentSelection = HandlerUtil.getCurrentSelection(event);
-            if (currentSelection instanceof IStructuredSelection) {
-                Object selectedElement = ((IStructuredSelection) currentSelection).getFirstElement();
-                if (selectedElement instanceof Classification) {
-                    ChecklistEditorInput input = new ChecklistEditorInput(((Classification) selectedElement));
-                    try {
-                        EditorUtil.open(input);
-                    } catch (PartInitException e) {
-                    	MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
-                    } catch (NullPointerException npe) {
-                    	MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
-                                "Could not open ChecklistView. The hierarchy is corrupted!", npe);
-                    }
-                } else if (selectedElement instanceof TaxonNode) {
-                    ChecklistEditorInput input = new ChecklistEditorInput(((TaxonNode) selectedElement));
-                    try {
-                        EditorUtil.open(input);
-                    } catch (PartInitException e) {
-                    	MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
-                    } catch (NullPointerException npe) {
-                    	MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
-                                "Could not open ChecklistView. The hierarchy is corrupted!", npe);
-                    }
-                }
-            }
-        }
-        return null;
-    }
+	@Override
+	protected void open(ExecutionEvent event, ITaxonTreeNode entity) {
+		if (PreferencesUtil.getPreferenceStore().getBoolean(IPreferenceKeys.DISTRIBUTION_AREA_PREFRENCES_ACTIVE)) {
+			if (entity instanceof Classification) {
+				ChecklistEditorInput input = new ChecklistEditorInput(((Classification) entity));
+				try {
+					EditorUtil.open(input);
+				} catch (PartInitException e) {
+					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
+				} catch (NullPointerException npe) {
+					MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
+							"Could not open ChecklistView. The hierarchy is corrupted!", npe);
+				}
+			} else if (entity instanceof TaxonNode) {
+				ChecklistEditorInput input = new ChecklistEditorInput((TaxonNode) entity);
+				try {
+					EditorUtil.open(input);
+				} catch (PartInitException e) {
+					MessagingUtils.error(OpenChecklistEditorHandler.class, "Could not open ChecklistView", e);
+				} catch (NullPointerException npe) {
+					MessagingUtils.messageDialog("Failed to open Editor", OpenChecklistEditorHandler.class,
+							"Could not open ChecklistView. The hierarchy is corrupted!", npe);
+				}
+			}
+		}		
+	}
 }
diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
index e6582f7fd..1bb4af14f 100644
--- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
+++ b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle.properties
@@ -8,7 +8,6 @@ command.label.1 = Edit
 menu.label = New
 command.label.2 = Taxon
 command.label.3 = Classification
-command.label.4 = Open in Checklist Editor
 command.label.5 = Edit
 command.label.6 = Change accepted taxon to synonym
 command.label.7 = Move taxon (with child taxa)
diff --git a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
index a561d9e43..f78b7e12d 100644
--- a/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
+++ b/eu.etaxonomy.taxeditor.navigation/OSGI-INF/l10n/bundle_de.properties
@@ -8,7 +8,6 @@ command.label.1 = Bearbeiten
 menu.label = Neu
 command.label.2 = Taxon
 command.label.3 = Klassifikation
-command.label.4 = \u00D6ffne im Checklisten Editor
 command.label.5 = Bearbeiten
 command.label.6 = Akzeptiertes Taxon zum Synonym umwandeln
 command.label.7 = Verschiebe Taxon (mit Kindern)
diff --git a/eu.etaxonomy.taxeditor.navigation/plugin.xml b/eu.etaxonomy.taxeditor.navigation/plugin.xml
index 2173e1efe..4960a059f 100644
--- a/eu.etaxonomy.taxeditor.navigation/plugin.xml
+++ b/eu.etaxonomy.taxeditor.navigation/plugin.xml
@@ -134,28 +134,6 @@
                </reference>
             </visibleWhen>
          </menu>
-         <command
-               commandId="eu.etaxonomy.taxeditor.editor.handler.OpenChecklistViewHandler"
-               icon="icons/check.png"
-               label="%command.label.4"
-               style="push">
-           <visibleWhen
-                 checkEnabled="true">
-              <and>
-                 <reference
-                       definitionId="isChecklistEditorEnabled">
-                 </reference>
-                 <or>
-                    <reference
-                          definitionId="isClassification">
-                    </reference>
-                    <reference
-                          definitionId="isTaxonNode">
-                    </reference>
-                 </or>
-              </and>
-            </visibleWhen>
-         </command>
          <command
                commandId="eu.etaxonomy.taxeditor.navigation.navigator.handler.OpenFixClassificationHierarchyHandler"
                label="%command.label.fixClassificationHierarchy"
