Add generic default command for opening taxon editor for taxa and taxon
authorPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 14 Dec 2015 17:18:12 +0000 (18:18 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Mon, 14 Dec 2015 17:18:12 +0000 (18:18 +0100)
nodes

eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorHandler.java [new file with mode: 0644]

index d6cc82eab6afb4ebd88098025c85e00b3b2df4ea..5c00f134daa022112f3a4ce9357a819cb254c119 100644 (file)
-#Properties file for taxeditor-editor\r
-Bundle-Vendor.0 = EDIT\r
-Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle\r
-command.name.17 = Set Basionym\r
-command.name.18 = Remove Basionym\r
-editor.name = Multipage Taxon Editor\r
-editor.name.0 = Taxon Name Editor\r
-editor.name.1 = Key\r
-editor.name.2 = Polytomous Key Graph Editor\r
-editor.name.3 = Polytomous Key List Editor\r
-editor.name.4 = Cdm Authority Editor\r
-editor.name.5 = Derivative Editor\r
-view.name = Factual Data\r
-view.name.0 = Uses\r
-view.name.1 = Media\r
-view.name.2 = Concept Relations\r
-view.name.3 = Concept Graph\r
-category.name = Taxonomic Editor\r
-command.label = Reference\r
-command.label.0 = Name\r
-command.label.1 = Team\r
-command.label.2 = Person\r
-command.label.3 = Specimen\r
-command.label.4 = Factual Data\r
-command.label.5 = Media\r
-command.label.6 = Concept\r
-command.label.7 = Concept Graph\r
-command.label.8 = Open Parent\r
-menu.label = New\r
-command.label.9 = Heterotypic Synonym\r
-command.label.10 = Homotypic Synonym\r
-command.label.11 = Synonym In Homotypical Group\r
-menu.label.0 = Change To\r
-command.label.12 = Accepted Taxon\r
-command.label.13 = Synonym\r
-command.label.14 = Misapplication\r
-command.label.15 = Delete\r
-command.label.16 = Delete All Empty Names\r
-command.label.17 = Swap Synonym With Accepted\r
-command.label.18 = Show Details\r
-command.label.19 = Save\r
-command.label.20 = New Node\r
-command.label.21 = Delete\r
-command.label.22 = Apply Layout\r
-command.label.23 = New Key Number\r
-command.label.24 = New Alternative\r
-command.label.25 = Refresh Nodes\r
-command.label.26 = Delete\r
-command.label.27 = New Factual Data\r
-menu.label.1 = New\r
-command.label.28 = Move Description to Taxon\r
-command.label.29 = Move Elements to Taxon\r
-command.label.30 = Delete\r
-command.label.31 = Save\r
-menu.label.2 = New Derivative\r
-command.label.32 = New Use\r
-command.label.33 = New Use Summary\r
-command.label.34 = New Use Record\r
-command.label.35 = Delete\r
-command.label.36 = Save\r
-command.label.37 = New Image Gallery\r
-command.label.38 = New Image\r
-command.label.39 = Move Image Up In List\r
-command.label.40 = Move Image Down In List\r
-command.label.41 = Delete\r
-command.label.42 = Save\r
-menu.label.3 = New\r
-command.label.43 = Open Related Concept\r
-command.label.44 = Delete\r
-command.label.45 = Edit Authorities\r
-extension.name = Name Commands\r
-category.name.0 = -- Name Editor\r
-command.name = Open Parent\r
-command.name.0 = Create Homotypic Synonym\r
-command.name.1 = Create Heterotypic Synonym\r
-command.name.2 = Create Synonym In Homotypical Group\r
-command.name.3 = Change To Synonym\r
-command.name.4 = Change To Accepted Taxon\r
-command.name.5 = Change To Misapplication\r
-command.name.6 = Swap Synonym With Accepted\r
-\r
-command.name.7 = Set Basionym / Original Combination\r
-command.name.8 = Remove Basionym / Original Combination\r
-command.name.9 = Delete All Empty Names\r
-category.name.1 = -- Factual\r
-command.name.10 = Create Description Element\r
-command.name.11 = New Description\r
-command.name.12 = Move Description Elements to Taxon\r
-command.name.13 = Move Description to Taxon\r
-category.name.2 = -- New Uses\r
-command.name.14 = New Use\r
-command.name.15 = New Use Summary\r
-command.name.16 = New Use Record\r
-category.name.3 = -- Media\r
-command.name.19 = Move Image Down In List\r
-command.name.20 = New Image Gallery\r
-command.name.21 = New Image\r
-command.name.22 = Move Image Up In List\r
-category.name.4 = -- New Entity\r
-command.name.23 = New Reference\r
-command.name.24 = New Name\r
-command.name.25 = New Team\r
-command.name.26 = New Person\r
-category.name.5 = -- Polytomous Keys\r
-command.name.28 = New Child Node\r
-command.name.29 = New Sibling Node\r
-command.name.30 = Refresh Node Numbering\r
-command.name.31 = Apply Layout\r
-category.name.6 = -- Concept Relations\r
-command.name.32 = Create Concept Relation\r
-command.name.33 = Open Related Concept\r
-category.name.7 = -- Group\r
-command.name.34 = Edit CDM Authorities\r
-command.name.35 = Open Derivative Editor\r
-scheme.description = The default key binding scheme for the Taxonomic Editor\r
-scheme.name = Taxonomic Editor Default Key Bindings\r
-editor.name.6 = Specimen Import Editor\r
-editor.name.7 = Gbif Import Editor\r
-editor.name.8 = Checklist Editor\r
-view.name.4 = Specimen Import\r
-view.name.5 = GBIF Specimen Import\r
-command.label.46 = Name\r
-command.label.47 = Reference\r
-command.label.48 = Datasource\r
-command.label.49 = Misapplication\r
-command.label.50 = Use Existing Image\r
-command.name.36 = Create Misapplication\r
-command.name.37 = Use Existing Image\r
-command.name.38 = Open Checklist Editor\r
-command.name.39 = New Datasource\r
-wizard.name = Specimen Search/Import\r
-wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.\r
-command.name.40 = Validation\r
-view.name.6 = Validation\r
-marker.field.0 = Object Type\r
-marker.field.1 = Object\r
-marker.field.2 = Attribute\r
-marker.field.3 = Problematic Value\r
-marker.field.4 = Problem description\r
-marker.field.5 = Validator\r
-marker.field.6 = Entity Class\r
-marker.field.7 = Entity Id\r
-extension.name.0 = Validation Error\r
-command.label.51 = Open in Specimen Editor\r
-command.label.52 = Delete\r
-command.label.53 = Create Field Unit\r
-command.label.54 = Delete (with children)\r
-command.tooltip = Show Only Individuals Associations\r
-command.label.55 = Open Associated Specimens\r
-command.name.41 = Show Only Individual Associations\r
-command.name.42 = Open Taxon Editor\r
-command.name.43 = Create Field Unit\r
-command.name.44 = Deep Delete\r
-command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon\r
-command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon\r
-markerContentGenerator.name = Validation Problems Marker Generator\r
-command.name.45 = Delete\r
-command.name.47 = Delete\r
-commandParameter.name = taxonUUID\r
-Bundle-Name = Editor Bundle\r
-command.name.48 = delete\r
-command.name.49 = delete\r
-command.name.50 = delete\r
+#Properties file for taxeditor-editor
+Bundle-Vendor.0 = EDIT
+Bundle-Name.0 = EDIT Taxonomic Editor - Editor Bundle
+command.name.17 = Set Basionym
+command.name.18 = Remove Basionym
+editor.name = Multipage Taxon Editor
+editor.name.0 = Taxon Name Editor
+editor.name.1 = Key
+editor.name.2 = Polytomous Key Graph Editor
+editor.name.3 = Polytomous Key List Editor
+editor.name.4 = Cdm Authority Editor
+editor.name.5 = Derivative Editor
+view.name = Factual Data
+view.name.0 = Uses
+view.name.1 = Media
+view.name.2 = Concept Relations
+view.name.3 = Concept Graph
+category.name = Taxonomic Editor
+command.label = Reference
+command.label.0 = Name
+command.label.1 = Team
+command.label.2 = Person
+command.label.3 = Specimen
+command.label.4 = Factual Data
+command.label.5 = Media
+command.label.6 = Concept
+command.label.7 = Concept Graph
+command.label.8 = Open Parent
+menu.label = New
+command.label.9 = Heterotypic Synonym
+command.label.10 = Homotypic Synonym
+command.label.11 = Synonym In Homotypical Group
+menu.label.0 = Change To
+command.label.12 = Accepted Taxon
+command.label.13 = Synonym
+command.label.14 = Misapplication
+command.label.15 = Delete
+command.label.16 = Delete All Empty Names
+command.label.17 = Swap Synonym With Accepted
+command.label.18 = Show Details
+command.label.19 = Save
+command.label.20 = New Node
+command.label.21 = Delete
+command.label.22 = Apply Layout
+command.label.23 = New Key Number
+command.label.24 = New Alternative
+command.label.25 = Refresh Nodes
+command.label.26 = Delete
+command.label.27 = New Factual Data
+menu.label.1 = New
+command.label.28 = Move Description to Taxon
+command.label.29 = Move Elements to Taxon
+command.label.30 = Delete
+command.label.31 = Save
+menu.label.2 = New Derivative
+command.label.32 = New Use
+command.label.33 = New Use Summary
+command.label.34 = New Use Record
+command.label.35 = Delete
+command.label.36 = Save
+command.label.37 = New Image Gallery
+command.label.38 = New Image
+command.label.39 = Move Image Up In List
+command.label.40 = Move Image Down In List
+command.label.41 = Delete
+command.label.42 = Save
+menu.label.3 = New
+command.label.43 = Open Related Concept
+command.label.44 = Delete
+command.label.45 = Edit Authorities
+extension.name = Name Commands
+category.name.0 = -- Name Editor
+command.name = Open Parent
+command.name.0 = Create Homotypic Synonym
+command.name.1 = Create Heterotypic Synonym
+command.name.2 = Create Synonym In Homotypical Group
+command.name.3 = Change To Synonym
+command.name.4 = Change To Accepted Taxon
+command.name.5 = Change To Misapplication
+command.name.6 = Swap Synonym With Accepted
+
+command.name.7 = Set Basionym / Original Combination
+command.name.8 = Remove Basionym / Original Combination
+command.name.9 = Delete All Empty Names
+category.name.1 = -- Factual
+command.name.10 = Create Description Element
+command.name.11 = New Description
+command.name.12 = Move Description Elements to Taxon
+command.name.13 = Move Description to Taxon
+category.name.2 = -- New Uses
+command.name.14 = New Use
+command.name.15 = New Use Summary
+command.name.16 = New Use Record
+category.name.3 = -- Media
+command.name.19 = Move Image Down In List
+command.name.20 = New Image Gallery
+command.name.21 = New Image
+command.name.22 = Move Image Up In List
+category.name.4 = -- New Entity
+command.name.23 = New Reference
+command.name.24 = New Name
+command.name.25 = New Team
+command.name.26 = New Person
+category.name.5 = -- Polytomous Keys
+command.name.28 = New Child Node
+command.name.29 = New Sibling Node
+command.name.30 = Refresh Node Numbering
+command.name.31 = Apply Layout
+category.name.6 = -- Concept Relations
+command.name.32 = Create Concept Relation
+command.name.33 = Open Related Concept
+category.name.7 = -- Group
+command.name.34 = Edit CDM Authorities
+command.name.35 = Open Derivative Editor
+scheme.description = The default key binding scheme for the Taxonomic Editor
+scheme.name = Taxonomic Editor Default Key Bindings
+editor.name.6 = Specimen Import Editor
+editor.name.7 = Gbif Import Editor
+editor.name.8 = Checklist Editor
+view.name.4 = Specimen Import
+view.name.5 = GBIF Specimen Import
+command.label.46 = Name
+command.label.47 = Reference
+command.label.48 = Datasource
+command.label.49 = Misapplication
+command.label.50 = Use Existing Image
+command.name.36 = Create Misapplication
+command.name.37 = Use Existing Image
+command.name.38 = Open Checklist Editor
+command.name.39 = New Datasource
+wizard.name = Specimen Search/Import
+wizard.description = Queries data provider for specimens with specified parameters.\nNote: Query results are currently limited to 100.
+command.name.40 = Validation
+view.name.6 = Validation
+marker.field.0 = Object Type
+marker.field.1 = Object
+marker.field.2 = Attribute
+marker.field.3 = Problematic Value
+marker.field.4 = Problem description
+marker.field.5 = Validator
+marker.field.6 = Entity Class
+marker.field.7 = Entity Id
+extension.name.0 = Validation Error
+command.label.51 = Open in Specimen Editor
+command.label.52 = Delete
+command.label.53 = Create Field Unit
+command.label.54 = Delete (with children)
+command.tooltip = Show Only Individuals Associations
+command.label.55 = Open Associated Specimens
+command.name.41 = Show Only Individual Associations
+command.name.42 = Open Taxon Editor for taxon
+command.name.43 = Create Field Unit
+command.name.44 = Deep Delete
+command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon
+command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon
+markerContentGenerator.name = Validation Problems Marker Generator
+command.name.45 = Delete
+command.name.47 = Delete
+commandParameter.name = taxonUUID
+Bundle-Name = Editor Bundle
+command.name.48 = delete
+command.name.49 = delete
+command.name.50 = delete
 command.name.51 = delete
index 9cb109b79571e12b692b26f2723ba7a36efd7504..fa3e6800a18f73988f5b35a61dc68e6c9521aced 100644 (file)
             name="%command.name.41">
       </command>
       <command
-            defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenTaxonEditorHandler"
-            id="eu.etaxonomy.taxeditor.editor.openTaxonEditor"
+            defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorHandler"
+            id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"
             name="%command.name.42">
          <commandParameter
-               id="eu.etaxonomy.taxeditor.editor.taxonParameter"
+               id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon.uuid"
                name="%commandParameter.name"
                optional="false"
-               typeId="eu.etaxonomy.taxeditor.editor.taxonParameterType">
+               typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+         </commandParameter>
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.editor.handler.defaultHandler.DefaultOpenTaxonEditorHandler"
+            id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode"
+            name="Open Taxon Editor for taxonnode">
+         <commandParameter
+               id="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode.uuid"
+               name="taxon node uuid"
+               optional="true"
+               typeId="eu.etaxonomy.taxeditor.uuidParameterType">
          </commandParameter>
       </command>
-      <commandParameterType
-            converter="eu.etaxonomy.taxeditor.editor.handler.TaxonParameterConverter"
-            id="eu.etaxonomy.taxeditor.editor.taxonParameterType"
-            type="eu.etaxonomy.cdm.model.taxon.TaxonBase">
-      </commandParameterType>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.DeleteDerivateHandler"
             id="eu.etaxonomy.taxeditor.editor.derivate.deepDelete"
    </extension>
    <extension
           point="eu.etaxonomy.taxeditor.store.cdmViewer">
-       <cdmViewer
-             class="eu.etaxonomy.taxeditor.editor.EditorCdmViewer">
-       </cdmViewer>
+      <viewCommandMapping
+            commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxonNode"
+            selection="eu.etaxonomy.cdm.model.taxon.TaxonNode"
+            viewerName="Taxon Editor">
+      </viewCommandMapping>
+      <viewCommandMapping
+            commandId="eu.etaxonomy.taxeditor.editor.openTaxonEditorForTaxon"
+            selection="eu.etaxonomy.cdm.model.taxon.TaxonBase"
+            viewerName="TaxonEditor">
+      </viewCommandMapping>
     </extension>
 </plugin>
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/EditorCdmViewer.java
deleted file mode 100644 (file)
index 796d19a..0000000
+++ /dev/null
@@ -1,62 +0,0 @@
-// $Id$
-/**
-* Copyright (C) 2015 EDIT
-* European Distributed Institute of Taxonomy
-* http://www.e-taxonomy.eu
-*
-* The contents of this file are subject to the Mozilla Public License Version 1.1
-* See LICENSE.TXT at the top of this package for the full license terms.
-*/
-package eu.etaxonomy.taxeditor.editor;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.cdm.model.occurrence.SpecimenOrObservationBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.editor.view.derivate.DerivateView;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.view.ICdmViewer;
-
-/**
- * @author pplitzner
- * @date Feb 23, 2015
- *
- */
-public class EditorCdmViewer implements ICdmViewer {
-
-    private final Logger logger = Logger.getLogger(EditorCdmViewer.class);
-
-    @Override
-    public void show(Object input, Class<?> viewerClass) {
-        try {
-            if(viewerClass.equals(MultiPageTaxonEditor.class)){
-                if(input instanceof TaxonBase){
-                    TaxonEditorInput editorInput = TaxonEditorInput.NewInstanceFromTaxonBase(((TaxonBase<?>) input).getUuid());
-                    EditorUtil.open(editorInput);
-                }
-            }
-            else if(viewerClass.equals(DerivateView.class)){
-                if(input instanceof SpecimenOrObservationBase){
-                }
-            }
-        } catch (PartInitException e) {
-            String errorMessage = "Could not open editor";
-            logger.error(errorMessage, e);
-            MessagingUtils.error(EditorCdmViewer.class, errorMessage, e);
-        }
-    }
-
-    @Override
-    public Map<Class<?>, String> getViewerClasses(Object input) {
-        Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
-        if(input instanceof TaxonBase){
-            viewerNameMap.put(MultiPageTaxonEditor.class, "Taxon Editor");
-        }
-        return viewerNameMap;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/OpenTaxonEditorHandler.java
deleted file mode 100644 (file)
index b416726..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-package eu.etaxonomy.taxeditor.editor.handler;
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.ParameterType;
-import org.eclipse.core.commands.common.NotDefinedException;
-import org.eclipse.ui.PartInitException;
-
-import eu.etaxonomy.taxeditor.editor.EditorUtil;
-import eu.etaxonomy.taxeditor.model.MessagingUtils;
-
-
-public class OpenTaxonEditorHandler extends AbstractHandler {
-
-    @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-        Object object = event.getObjectParameterForExecution("eu.etaxonomy.taxeditor.editor.taxonParameter");
-
-        try {
-            ParameterType parameterType = event.getCommand().getParameterType("eu.etaxonomy.taxeditor.editor.taxonParameter");
-            if(parameterType.isCompatible(object)){
-                EditorUtil.openTaxonEditor(object);
-            }
-        } catch (NotDefinedException e) {
-            MessagingUtils.error(this.getClass(), "Parameter type not defined", e);
-        } catch (PartInitException e) {
-            MessagingUtils.error(OpenTaxonEditorHandler.class, "Error opening the editor", e);
-        }
-        return null;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/TaxonParameterConverter.java
deleted file mode 100644 (file)
index 0283f4d..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package eu.etaxonomy.taxeditor.editor.handler;
-
-import java.util.UUID;
-
-import org.eclipse.core.commands.AbstractParameterValueConverter;
-import org.eclipse.core.commands.ParameterValueConversionException;
-
-import eu.etaxonomy.cdm.api.service.ITaxonService;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.store.CdmStore;
-
-public class TaxonParameterConverter extends AbstractParameterValueConverter {
-
-    public TaxonParameterConverter() {
-    }
-
-    @Override
-    public Object convertToObject(String parameterValue) throws ParameterValueConversionException {
-        return CdmStore.getService(ITaxonService.class).load(UUID.fromString(parameterValue));
-    }
-
-    @Override
-    public String convertToString(Object parameterValue) throws ParameterValueConversionException {
-        if(parameterValue instanceof TaxonBase<?>){
-            return ((TaxonBase<?>) parameterValue).getUuid().toString();
-        }
-        return null;
-    }
-
-}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorHandler.java
new file mode 100644 (file)
index 0000000..21a2ffa
--- /dev/null
@@ -0,0 +1,84 @@
+package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
+import java.util.UUID;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+import org.eclipse.core.commands.ParameterType;
+import org.eclipse.core.commands.common.NotDefinedException;
+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.ITaxonNodeService;
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
+import eu.etaxonomy.cdm.model.taxon.Taxon;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.cdm.model.taxon.TaxonNode;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenClassificationWizardHandler;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class DefaultOpenTaxonEditorHandler extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        String commandId = event.getCommand().getId();
+        String uuidParameterId = commandId+".uuid";
+        //check if uuid parameter is set
+        if(event.getParameter(uuidParameterId)!=null){
+            Object object = event.getObjectParameterForExecution(uuidParameterId);
+            ParameterType parameterType;
+            try {
+                parameterType = event.getCommand().getParameterType(uuidParameterId);
+                if(parameterType.isCompatible(object)){
+                    TaxonNode taxonNode = CdmStore.getService(ITaxonNodeService.class).load((UUID) object);
+                    if(taxonNode!=null){
+                        openTaxonEditor(event, taxonNode.getTaxon().getUuid());
+                    }
+                    else {
+                        TaxonBase taxon = CdmStore.getService(ITaxonService.class).load((UUID) object);
+                        openTaxonEditor(event, taxon.getUuid());
+                    }
+                }
+            } catch (NotDefinedException e) {
+                MessagingUtils.error(DefaultOpenClassificationWizardHandler.class, "Error while opening classification!", e);
+            }
+        }
+        //if not try current selection
+        else{
+            ISelection selection = HandlerUtil.getCurrentSelection(event);
+
+            if(selection instanceof IStructuredSelection){
+                final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
+
+                Taxon taxon = null;
+                Object firstElement = structuredSelection.getFirstElement();
+                if(firstElement instanceof TaxonBase){
+                    openTaxonEditor(event, (HibernateProxyHelper.deproxy(firstElement, TaxonBase.class).getUuid()));
+                }
+                else if(firstElement instanceof TaxonNode){
+                    taxon = (HibernateProxyHelper.deproxy(firstElement, TaxonNode.class)).getTaxon();
+                    openTaxonEditor(event, taxon.getUuid());
+                }
+            }
+        }
+        return null;
+    }
+
+    private void openTaxonEditor(ExecutionEvent event, UUID taxonUuid) {
+        TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(taxonUuid);
+        try {
+            EditorUtil.open(input);
+        } catch (PartInitException e) {
+            MessagingUtils.error(DefaultOpenTaxonEditorHandler.class, "Could not open taxon editor for taxon "+input.getTaxon(), e);
+        }
+    }
+
+
+}