Merge branch 'develop' of ssh://dev.e-taxonomy.eu/var/git/taxeditor into develop
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 6 Jan 2016 16:03:19 +0000 (17:03 +0100)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 6 Jan 2016 16:03:19 +0000 (17:03 +0100)
25 files changed:
eu.etaxonomy.taxeditor.application/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/referencingobjects/ReferencingObjectsView.java
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/DefaultOpenTaxonEditorForTaxonHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonNodeHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/view/derivate/DerivateView.java
eu.etaxonomy.taxeditor.navigation/plugin.xml
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationCdmViewer.java [deleted file]
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationUtil.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java [deleted file]
eu.etaxonomy.taxeditor.store/META-INF/MANIFEST.MF
eu.etaxonomy.taxeditor.store/plugin.xml
eu.etaxonomy.taxeditor.store/schema/eu.etaxonomy.taxeditor.store.cdmViewer.exsd
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/UuidsParameterTypeConverter.java [moved from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/UuidParameterConverter.java with 67% similarity]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenHandlerBase.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java [new file with mode: 0644]
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerChooser.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerContextMenu.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/CdmViewerUtil.java

index 7453e21473a12630f904c3ffd7d57e170523f85f..ae74af849e0ff876087aa64776ee4fe35b24249c 100644 (file)
             id="eu.etaxonomy.taxeditor.application.perspective.taxonomic"
             name="%perspective.name">
       </perspective>
-      <!--perspective
-            class="eu.etaxonomy.taxeditor.perspective.BulkEditing"
-            id="eu.etaxonomy.taxeditor.application.perspective.bulkeditor"
-            name="Bulk Editing">
-      </perspective-->
       <perspective
             class="eu.etaxonomy.taxeditor.perspective.PolytomousKey"
             id="eu.etaxonomy.taxeditor.application.perspective.polytomous"
             restorable="true">
       </view>
    </extension-->
- <extension
-       point="org.eclipse.ui.perspectiveExtensions">
-    <perspectiveExtension
-          targetID="eu.etaxonomy.taxeditor.application.perspective.bulkeditor">
-       <showInPart
-             id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
-       </showInPart>
-       <showInPart
-             id="eu.etaxonomy.taxeditor.bulkeditor.referencingobjectsview">
-       </showInPart>
-    </perspectiveExtension>
-    <perspectiveExtension
-          targetID="eu.etaxonomy.taxeditor.application.perspective.polytomous">
-       <showInPart
-             id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
-       </showInPart>
-    </perspectiveExtension>
-    <perspectiveExtension
-          targetID="eu.etaxonomy.taxeditor.application.perspective.uses">
-       <showInPart
-             id="eu.etaxonomy.taxeditor.editor.forms.detailsView">
-       </showInPart>
-    </perspectiveExtension>
- </extension>
    <extension
          point="org.eclipse.ui.menus">
       <menuContribution
index 0f3dae0a7c126dc887a28b69ad3a172d8bcdc88c..6862728464568f5b5d8630b79e6f797da723612e 100644 (file)
-<?xml version="1.0" encoding="UTF-8"?>\r
-<?eclipse version="3.4"?>\r
-<plugin>\r
-\r
-   <extension\r
-         id="application"\r
-         point="org.eclipse.core.runtime.applications">\r
-      <application>\r
-         <run\r
-               class="eu.etaxonomy.taxeditor.bulkeditor.Application">\r
-         </run>\r
-      </application>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.editors">\r
-      <editor\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"\r
-            default="false"\r
-            id="bulkeditor.editor"\r
-            name="%editor.name">\r
-      </editor>\r
-      <editor\r
-            class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"\r
-            default="false"\r
-            id="nameeditor.editor"\r
-            name="%editor.name.0">\r
-      </editor>\r
-      <editor\r
-            class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
-            default="false"\r
-            id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"\r
-            name="%editor.name.1">\r
-      </editor>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.menus">\r
-      <menuContribution\r
-            locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">\r
-         <menu\r
-               id="bulkeditor.menus.openmenu"\r
-               label="%menu.label">\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </menu>\r
-         <menu\r
-               label="%menu.label.0">\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </menu>\r
-      </menuContribution>\r
-      <menuContribution\r
-            locationURI="menu:bulkeditor.menus.openmenu">\r
-         <dynamic\r
-               class="eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem"\r
-               id="taxeditor-bulkeditor.dynamicopenmenu">\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </dynamic>\r
-         <!--command\r
-               commandId="taxeditor-nameeditor.commands.open"\r
-               label="Open Name Editor"\r
-               style="push">\r
-            <visibleWhen\r
-                  checkEnabled="false">\r
-               <reference\r
-                     definitionId="pigsFly">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command-->\r
-      </menuContribution>\r
-      <menuContribution\r
-            locationURI="popup:#BulkEditorContext">\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"\r
-               label="%command.label"\r
-               style="push">\r
-            <visibleWhen>\r
-               <reference\r
-                     definitionId="isTaxonBulkEditorInput">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
-         <separator\r
-               name="taxeditor-bulkeditor.separator1"\r
-               visible="true">\r
-         </separator>\r
-         <menu\r
-               label="%menu.label.1">\r
-            <dynamic\r
-                  class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"\r
-                  id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">\r
-               <visibleWhen\r
-                     checkEnabled="false">\r
-                  <reference\r
-                        definitionId="isCdmStoreConnected">\r
-                  </reference>\r
-               </visibleWhen>\r
-            </dynamic>\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </menu>\r
-        <separator\r
+<?xml version="1.0" encoding="UTF-8"?>
+<?eclipse version="3.4"?>
+<plugin>
+
+   <extension
+         id="application"
+         point="org.eclipse.core.runtime.applications">
+      <application>
+         <run
+               class="eu.etaxonomy.taxeditor.bulkeditor.Application">
+         </run>
+      </application>
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors">
+      <editor
+            class="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor"
+            default="false"
+            id="bulkeditor.editor"
+            name="%editor.name">
+      </editor>
+      <editor
+            class="eu.etaxonomy.taxeditor.nameditor.TaxonNameEditor"
+            default="false"
+            id="nameeditor.editor"
+            name="%editor.name.0">
+      </editor>
+      <editor
+            class="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
+            default="false"
+            id="eu.etaxonomy.taxeditor.dataimport.DataImportEditor"
+            name="%editor.name.1">
+      </editor>
+   </extension>
+   <extension
+         point="org.eclipse.ui.menus">
+      <menuContribution
+            locationURI="menu:org.eclipse.ui.main.menu.window?before=eu.etaxonomy.taxeditor.application.windowMenu.last">
+         <menu
+               id="bulkeditor.menus.openmenu"
+               label="%menu.label">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </menu>
+         <menu
+               label="%menu.label.0">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </menu>
+      </menuContribution>
+      <menuContribution
+            locationURI="menu:bulkeditor.menus.openmenu">
+         <dynamic
+               class="eu.etaxonomy.taxeditor.bulkeditor.command.OpenBulkEditorContributionItem"
+               id="taxeditor-bulkeditor.dynamicopenmenu">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </dynamic>
+      </menuContribution>
+      <menuContribution
+            locationURI="popup:#BulkEditorContext">
+         <dynamic
+               class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+               id="eu.etaxonomy.taxeditor.bulkeditor.cdmViewerContextMenu">
+         </dynamic>
+         <separator
+               name="taxeditor-bulkeditor.separator1"
+               visible="true">
+         </separator>
+         <menu
+               label="%menu.label.1">
+            <dynamic
+                  class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicNewObjectMenu"
+                  id="eu.etaxonomy.taxeditor.bulkeditor.dynamicNewMenu">
+               <visibleWhen
+                     checkEnabled="false">
+                  <reference
+                        definitionId="isCdmStoreConnected">
+                  </reference>
+               </visibleWhen>
+            </dynamic>
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </menu>
+         <separator
                name="taxeditor-bulkeditor.separator4"\r
                visible="true">\r
-         </separator>\r
-         <command\r
-               commandId="bulkeditor.commands.setmergetarget"\r
-               label="%command.label.0"\r
-               style="push">\r
-            <visibleWhen>\r
-               <reference\r
-                     definitionId="isMergeEnabled">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
-         \r
-         <command\r
-               commandId="bulkeditor.commands.setmergecandidate"\r
-               label="%command.label.1"\r
-               style="push">\r
-            <visibleWhen>\r
-               <reference\r
-                     definitionId="isMergeEnabled">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
-         <command\r
-               commandId="bulkeditor.commands.removemergecandidate"\r
-               label="%command.label.2"\r
-               style="push">\r
-            <visibleWhen>\r
-               <reference\r
-                     definitionId="isMergeEnabled">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
-      <!--menuContribution\r
-            locationURI="popup:org.eclipse.ui.popup.any"-->            \r
-         <command\r
-               commandId="bulkeditor.commands.mergegroup"\r
-               label="%command.label.3"\r
-               style="push">\r
-            <visibleWhen>\r
-               <reference\r
-                     definitionId="isMergeEnabled">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
+         </separator>
+         <command
+               commandId="bulkeditor.commands.setmergetarget"
+               label="%command.label.0"
+               style="push">
+            <visibleWhen>
+               <reference
+                     definitionId="isMergeEnabled">
+               </reference>
+            </visibleWhen>
+         </command>
+         
+         <command
+               commandId="bulkeditor.commands.setmergecandidate"
+               label="%command.label.1"
+               style="push">
+            <visibleWhen>
+               <reference
+                     definitionId="isMergeEnabled">
+               </reference>
+            </visibleWhen>
+         </command>
+         <command
+               commandId="bulkeditor.commands.removemergecandidate"
+               label="%command.label.2"
+               style="push">
+            <visibleWhen>
+               <reference
+                     definitionId="isMergeEnabled">
+               </reference>
+            </visibleWhen>
+         </command>
+      <!--menuContribution
+            locationURI="popup:org.eclipse.ui.popup.any"-->            
+         <command
+               commandId="bulkeditor.commands.mergegroup"
+               label="%command.label.3"
+               style="push">
+            <visibleWhen>
+               <reference
+                     definitionId="isMergeEnabled">
+               </reference>
+            </visibleWhen>
+         </command>
          <separator\r
                name="eu.etaxonomy.taxeditor.bulkeditor.separator1"\r
                visible="true">\r
          </separator>\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"\r
-               label="%command.label.5"\r
-               style="push">\r
-                  <visibleWhen\r
-                               checkEnabled="true">\r
-                               <and>\r
-                               <reference\r
-                       definitionId="isConvertEnabled">\r
-                               </reference>\r
-                               <reference \r
-                                               definitionId="isTeam">\r
-                               </reference>\r
-                       </and>\r
-                       </visibleWhen>\r
-         </command>\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"\r
-               label="%command.label.6"\r
-               style="push">\r
-               <visibleWhen \r
-                       checkEnabled="true">>\r
-                               <and>\r
-                               <reference\r
-                       definitionId="isConvertEnabled">\r
-                               </reference>\r
-                               <reference \r
-                                       definitionId="isPerson">\r
-                               </reference>\r
-                       </and>\r
-                       </visibleWhen>\r
-         </command>\r
-         <separator\r
-               name="taxeditor-bulkeditor.separator2"\r
-               visible="true">\r
-         </separator>\r
-         <menu\r
-               label="%menu.label.2">\r
-            <dynamic\r
-                  class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"\r
-                  id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">\r
-            </dynamic>\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </menu>\r
-         <separator\r
-               name="taxeditor-bulkeditor.separator3"\r
-               visible="true">\r
-         </separator>\r
-         <command\r
-               commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
-               label="%command.label.4"\r
-               style="push">\r
-            <visibleWhen\r
-                  checkEnabled="true">\r
-               <reference\r
-                     definitionId="isCdmStoreConnected">\r
-               </reference>\r
-            </visibleWhen>\r
-         </command>\r
-      </menuContribution>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.commands">\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler"\r
-            id="bulkeditor.commands.mergegroup"\r
-            name="%command.name">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeTargetHandler"\r
-            id="bulkeditor.commands.setmergetarget"\r
-            name="%command.name.0">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.OpenBulkEditorHandler"\r
-            id="taxeditor-bulkeditor.dynamicopenmenu"\r
-            name="%command.name.1">\r
-         <commandParameter\r
-               id="taxeditor-bulkeditor.commandParameter.inputType"\r
-               name="%commandParameter.name"\r
-               values="eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues">\r
-         </commandParameter>\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.NewObjectHandler"\r
-            id="taxeditor-bulkeditor.dynamicnewobjectcommand"\r
-            name="%command.name.2">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.DeleteObjectHandler"\r
-            id="taxeditor-bulkeditor.dynamicdeleteobjectcommand"\r
-            name="%command.name.3">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeCandidateHandler"\r
-            id="bulkeditor.commands.setmergecandidate"\r
-            name="%command.name.4">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.RemoveMergeCandidateHandler"\r
-            id="bulkeditor.commands.removemergecandidate"\r
-            name="%command.name.5">\r
-      </command>\r
-      <command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"\r
-            id="taxeditor-bulkeditor.command.setMarkerFlag"\r
-            name="%command.name.6">\r
-      </command>\r
-      <command\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.delete"\r
-            name="%command.name.7">\r
-      </command>\r
-      <command\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"\r
-            name="%command.name.8">\r
-      </command>\r
-      <command\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"\r
-            name="%command.name.10">\r
-      </command>\r
-      <!--command\r
-            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.command.new"\r
-            name="New Entity">\r
-      </command-->\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.editors.markerAnnotationSpecification">\r
-      <specification\r
-            annotationType="merge_candidate_annotation"\r
-            colorPreferenceKey="merge_candidate_annotation_color"\r
-            colorPreferenceValue="220,220,255"\r
-            highlightPreferenceValue="true"\r
-            icon="icons/merge_candidate.gif"\r
-            includeOnPreferencePage="true"\r
-            label="%specification.label"\r
-            overviewRulerPreferenceKey="merge_candidate_annotation_overview"\r
-            overviewRulerPreferenceValue="true"\r
-            presentationLayer="0"\r
-            symbolicIcon="task"\r
-            textPreferenceKey="merge_candidate_annotation_text"\r
-            textPreferenceValue="false"\r
-            textStylePreferenceValue="BOX"\r
-            verticalRulerPreferenceKey="merge_candidate_annotation_vertical"\r
-            verticalRulerPreferenceValue="true">\r
-      </specification>\r
-      <specification\r
-            annotationType="merge_target_annotation"\r
-            colorPreferenceKey="merge_target_annotation_color"\r
-            colorPreferenceValue="220,220,255"\r
-            highlightPreferenceValue="true"\r
-            icon="icons/merge_target.gif"\r
-            includeOnPreferencePage="true"\r
-            label="%specification.label.0"\r
-            overviewRulerPreferenceKey="merge_target_annotation_overview"\r
-            overviewRulerPreferenceValue="true"\r
-            presentationLayer="1"\r
-            symbolicIcon="task"\r
-            textPreferenceKey="merge_target_annotation_text"\r
-            textPreferenceValue="false"\r
-            textStylePreferenceValue="BOX"\r
-            verticalRulerPreferenceKey="merge_target_annotation_vertical"\r
-            verticalRulerPreferenceValue="true">\r
-      </specification>      \r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.editors.annotationTypes">\r
-      <type\r
-            name="merge_candidate_annotation">\r
-      </type>\r
-      <type\r
-            name="merge_target_annotation">\r
-      </type>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.views">\r
-      <view\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView"\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"\r
-            name="%view.name"\r
-            restorable="false">\r
-      </view>\r
-   </extension>   \r
-   <extension\r
-         point="org.eclipse.core.expressions.definitions">\r
-      <definition\r
-            id="isMergeEnabled">\r
-         <with\r
-               variable="activeEditor">\r
-            <test\r
-                  property="taxeditor-bulkeditor.propertyTester.isMergingEnabled">\r
-            </test>\r
-         </with>\r
-      </definition>\r
-      <definition\r
-            id="isConvertEnabled">\r
-         <with\r
-               variable="activeEditor">\r
-            <test\r
-                  property="taxeditor-bulkeditor.propertyTester.isConvertingEnabled">\r
-            </test>\r
-         </with>\r
-      </definition>\r
-      <definition\r
-            id="isTaxonBulkEditorInput">\r
-         <with\r
-               variable="activeEditor">\r
-            <test\r
-                  property="taxeditor-bulkeditor.propertyTester.isTaxonEditor">\r
-            </test>\r
-         </with>\r
-      </definition>\r
-       <definition\r
-            id="isTeam">\r
-         <with\r
-               variable="selection">\r
-            <test\r
-                  property="eu.etaxonomy.taxeditor.bulkeditor.command.isTeam">\r
-            </test>\r
-         </with>\r
-      </definition>\r
-      <definition\r
-            id="isPerson">\r
-         <with\r
-               variable="selection">\r
-            <test\r
-                  property="eu.etaxonomy.taxeditor.bulkeditor.command.isPerson">\r
-            </test>\r
-         </with>\r
-      </definition>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.core.expressions.propertyTesters">\r
-      <propertyTester\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"\r
-            id="taxeditor-bulkeditor.PropertyTester"\r
-            namespace="taxeditor-bulkeditor.propertyTester"\r
-            properties="isMergingEnabled, isDerivedUnitEditor, isTaxonEditor, isGroupEditor, isConvertingEnabled"\r
-            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
-      </propertyTester>\r
-      <propertyTester\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"\r
-            namespace="eu.etaxonomy.taxeditor.bulkeditor.command"\r
-            properties="isTeam, isPerson"\r
-            type="java.lang.Object">\r
-      </propertyTester>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.handlers">\r
-      <handler\r
-            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"\r
-            commandId="org.eclipse.ui.edit.cut">\r
-         <activeWhen>\r
-            <with\r
-                  variable="activeFocusControlId">\r
-               <equals\r
-                     value="bulkeditor.textControlId">\r
-               </equals>\r
-            </with>\r
-         </activeWhen>\r
-      </handler>\r
-      <handler\r
-            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"\r
-            commandId="org.eclipse.ui.edit.copy">\r
-         <activeWhen>\r
-            <with\r
-                  variable="activeFocusControlId">\r
-               <equals\r
-                     value="bulkeditor.textControlId">\r
-               </equals>\r
-            </with>\r
-         </activeWhen>\r
-      </handler>\r
-      <handler\r
-            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"\r
-            commandId="org.eclipse.ui.edit.paste">\r
-         <activeWhen>\r
-            <with\r
-                  variable="activeFocusControlId">\r
-               <equals\r
-                     value="bulkeditor.textControlId">\r
-               </equals>\r
-            </with>\r
-         </activeWhen>\r
-      </handler>\r
-      <handler\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"\r
-            commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">\r
-         <activeWhen>\r
-            <with\r
-                  variable="selection">\r
-               <instanceof\r
-                     value="eu.etaxonomy.taxeditor.model.LineSelection">\r
-               </instanceof>\r
-            </with>\r
-         </activeWhen>\r
-      </handler>\r
-      <handler\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler"\r
-            commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person">\r
-      </handler>\r
-      <handler\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"\r
-            commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">\r
-      </handler>\r
-      \r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.preferencePages">\r
-      <page\r
-            category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"\r
-            id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"\r
-            name="%page.name">\r
-      </page>\r
-      <page\r
-            category="eu.etaxonomy.taxeditor.preferences.general"\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"\r
-            id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"\r
-            name="%page.name.0">\r
-      </page>\r
-   </extension>\r
-   <extension\r
-         point="org.eclipse.ui.perspectiveExtensions">\r
-      <perspectiveExtension\r
-            targetID="*">\r
-         <showInPart\r
-               id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"></showInPart>\r
-         <showInPart\r
-               id="eu.etaxonomy.taxeditor.view.detail">\r
-         </showInPart>\r
-      </perspectiveExtension>\r
-   </extension>\r
-<!-- start set marker -->\r
-\r
-</plugin>\r
+         <command
+               commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
+               label="%command.label.5"
+               style="push">
+                  <visibleWhen
+                               checkEnabled="true">
+                               <and>
+                               <reference
+                       definitionId="isConvertEnabled">
+                               </reference>
+                               <reference 
+                                               definitionId="isTeam">
+                               </reference>
+                       </and>
+                       </visibleWhen>
+         </command>
+         <command
+               commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
+               label="%command.label.6"
+               style="push">
+               <visibleWhen 
+                       checkEnabled="true">>
+                               <and>
+                               <reference
+                       definitionId="isConvertEnabled">
+                               </reference>
+                               <reference 
+                                       definitionId="isPerson">
+                               </reference>
+                       </and>
+                       </visibleWhen>
+         </command>
+         <separator
+               name="taxeditor-bulkeditor.separator2"
+               visible="true">
+         </separator>
+         <menu
+               label="%menu.label.2">
+            <dynamic
+                  class="eu.etaxonomy.taxeditor.bulkeditor.command.DynamicMarkerTypeEditingMenu"
+                  id="eu.etaxonomy.taxeditor.bulkeditor.dynamicMarkerTypeEditingMenu">
+            </dynamic>
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </menu>
+         <separator
+               name="taxeditor-bulkeditor.separator3"
+               visible="true">
+         </separator>
+         <command
+               commandId="eu.etaxonomy.taxeditor.bulkeditor.delete"
+               label="%command.label.4"
+               style="push">
+            <visibleWhen
+                  checkEnabled="true">
+               <reference
+                     definitionId="isCdmStoreConnected">
+               </reference>
+            </visibleWhen>
+         </command>
+      </menuContribution>
+      <menuContribution
+            allPopups="false"
+            locationURI="popup:eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects">
+         <dynamic
+               class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+               id="eu.etaxonomy.taxeditor.referencingObjectsView.cdmViewerContextMenu">
+         </dynamic>
+      </menuContribution>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.MergeGroupHandler"
+            id="bulkeditor.commands.mergegroup"
+            name="%command.name">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeTargetHandler"
+            id="bulkeditor.commands.setmergetarget"
+            name="%command.name.0">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.OpenBulkEditorHandler"
+            id="taxeditor-bulkeditor.dynamicopenmenu"
+            name="%command.name.1">
+         <commandParameter
+               id="taxeditor-bulkeditor.commandParameter.inputType"
+               name="%commandParameter.name"
+               values="eu.etaxonomy.taxeditor.bulkeditor.input.BulkEditorInputTypeValues">
+         </commandParameter>
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.NewObjectHandler"
+            id="taxeditor-bulkeditor.dynamicnewobjectcommand"
+            name="%command.name.2">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.annotatedlineeditor.handler.DeleteObjectHandler"
+            id="taxeditor-bulkeditor.dynamicdeleteobjectcommand"
+            name="%command.name.3">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMergeCandidateHandler"
+            id="bulkeditor.commands.setmergecandidate"
+            name="%command.name.4">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.RemoveMergeCandidateHandler"
+            id="bulkeditor.commands.removemergecandidate"
+            name="%command.name.5">
+      </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.SetMarkerFlagHandler"
+            id="taxeditor-bulkeditor.command.setMarkerFlag"
+            name="%command.name.6">
+      </command>
+      <command
+            id="eu.etaxonomy.taxeditor.bulkeditor.delete"
+            name="%command.name.7">
+      </command>
+      <command
+            id="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person"
+            name="%command.name.8">
+      </command>
+      <command
+            id="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team"
+            name="%command.name.10">
+      </command>
+      <command
+            id="eu.etaxonomy.taxeditor.openReferencingObjectsView"
+            name="Open Referencing Objects View">
+      </command>
+      <!--command
+            defaultHandler="eu.etaxonomy.taxeditor.bulkeditor.handler.NewEntityHandler"
+            id="eu.etaxonomy.taxeditor.bulkeditor.command.new"
+            name="New Entity">
+      </command-->
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.markerAnnotationSpecification">
+      <specification
+            annotationType="merge_candidate_annotation"
+            colorPreferenceKey="merge_candidate_annotation_color"
+            colorPreferenceValue="220,220,255"
+            highlightPreferenceValue="true"
+            icon="icons/merge_candidate.gif"
+            includeOnPreferencePage="true"
+            label="%specification.label"
+            overviewRulerPreferenceKey="merge_candidate_annotation_overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="0"
+            symbolicIcon="task"
+            textPreferenceKey="merge_candidate_annotation_text"
+            textPreferenceValue="false"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="merge_candidate_annotation_vertical"
+            verticalRulerPreferenceValue="true">
+      </specification>
+      <specification
+            annotationType="merge_target_annotation"
+            colorPreferenceKey="merge_target_annotation_color"
+            colorPreferenceValue="220,220,255"
+            highlightPreferenceValue="true"
+            icon="icons/merge_target.gif"
+            includeOnPreferencePage="true"
+            label="%specification.label.0"
+            overviewRulerPreferenceKey="merge_target_annotation_overview"
+            overviewRulerPreferenceValue="true"
+            presentationLayer="1"
+            symbolicIcon="task"
+            textPreferenceKey="merge_target_annotation_text"
+            textPreferenceValue="false"
+            textStylePreferenceValue="BOX"
+            verticalRulerPreferenceKey="merge_target_annotation_vertical"
+            verticalRulerPreferenceValue="true">
+      </specification>      
+   </extension>
+   <extension
+         point="org.eclipse.ui.editors.annotationTypes">
+      <type
+            name="merge_candidate_annotation">
+      </type>
+      <type
+            name="merge_target_annotation">
+      </type>
+   </extension>
+   <extension
+         point="org.eclipse.ui.views">
+      <view
+            class="eu.etaxonomy.taxeditor.bulkeditor.referencingobjects.ReferencingObjectsView"
+            id="eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects"
+            name="%view.name"
+            restorable="false">
+      </view>
+   </extension>   
+   <extension
+         point="org.eclipse.core.expressions.definitions">
+      <definition
+            id="isMergeEnabled">
+         <with
+               variable="activeEditor">
+            <test
+                  property="taxeditor-bulkeditor.propertyTester.isMergingEnabled">
+            </test>
+         </with>
+      </definition>
+      <definition
+            id="isConvertEnabled">
+         <with
+               variable="activeEditor">
+            <test
+                  property="taxeditor-bulkeditor.propertyTester.isConvertingEnabled">
+            </test>
+         </with>
+      </definition>
+      <definition
+            id="isTaxonBulkEditorInput">
+         <with
+               variable="activeEditor">
+            <test
+                  property="taxeditor-bulkeditor.propertyTester.isTaxonEditor">
+            </test>
+         </with>
+      </definition>
+       <definition
+            id="isTeam">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.bulkeditor.command.isTeam">
+            </test>
+         </with>
+      </definition>
+      <definition
+            id="isPerson">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.bulkeditor.command.isPerson">
+            </test>
+         </with>
+      </definition>
+   </extension>
+   <extension
+         point="org.eclipse.core.expressions.propertyTesters">
+      <propertyTester
+            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"
+            id="taxeditor-bulkeditor.PropertyTester"
+            namespace="taxeditor-bulkeditor.propertyTester"
+            properties="isMergingEnabled, isDerivedUnitEditor, isTaxonEditor, isGroupEditor, isConvertingEnabled"
+            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">
+      </propertyTester>
+      <propertyTester
+            class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"
+            id="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorMenuPropertyTester"
+            namespace="eu.etaxonomy.taxeditor.bulkeditor.command"
+            properties="isTeam, isPerson"
+            type="java.lang.Object">
+      </propertyTester>
+   </extension>
+   <extension
+         point="org.eclipse.ui.handlers">
+      <handler
+            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:cut"
+            commandId="org.eclipse.ui.edit.cut">
+         <activeWhen>
+            <with
+                  variable="activeFocusControlId">
+               <equals
+                     value="bulkeditor.textControlId">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
+      <handler
+            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:copy"
+            commandId="org.eclipse.ui.edit.copy">
+         <activeWhen>
+            <with
+                  variable="activeFocusControlId">
+               <equals
+                     value="bulkeditor.textControlId">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
+      <handler
+            class="org.eclipse.ui.internal.handlers.WidgetMethodHandler:paste"
+            commandId="org.eclipse.ui.edit.paste">
+         <activeWhen>
+            <with
+                  variable="activeFocusControlId">
+               <equals
+                     value="bulkeditor.textControlId">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.bulkeditor.handler.DeleteHandler"
+            commandId="eu.etaxonomy.taxeditor.bulkeditor.delete">
+         <activeWhen>
+            <with
+                  variable="selection">
+               <instanceof
+                     value="eu.etaxonomy.taxeditor.model.LineSelection">
+               </instanceof>
+            </with>
+         </activeWhen>
+      </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertTeam2PersonHandler"
+            commandId="eu.etaxonomy.taxeditor.bulkeditor.convertTeam2Person">
+      </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.bulkeditor.handler.ConvertPerson2TeamHandler"
+            commandId="eu.etaxonomy.taxeditor.bulkeditor.convertPerson2Team">
+      </handler>
+      <handler
+            class="eu.etaxonomy.taxeditor.handler.defaultHandler.OpenReferencingObjectsView"
+            commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView">
+         <activeWhen>
+            <with
+                  variable="activePartId">
+               <equals
+                     value="bulkeditor.editor">
+               </equals>
+            </with>
+         </activeWhen>
+      </handler>
+      
+   </extension>
+   <extension
+         point="org.eclipse.ui.preferencePages">
+      <page
+            category="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+            class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorMarkerPreferencePage"
+            id="eu.etaxonomy.taxeditor.preferences.bulkeditor.markerTypes"
+            name="%page.name">
+      </page>
+      <page
+            category="eu.etaxonomy.taxeditor.preferences.general"
+            class="eu.etaxonomy.taxeditor.bulkeditor.preference.BulkEditorGeneralPreferencePage"
+            id="eu.etaxonomy.taxeditor.preferences.bulkeditor.general"
+            name="%page.name.0">
+      </page>
+   </extension>
+   <extension
+         point="eu.etaxonomy.taxeditor.store.cdmViewer">
+      <viewCommandMapping
+            commandId="eu.etaxonomy.taxeditor.openReferencingObjectsView"
+            selection="java.lang.Object"
+            viewerName="Referencing Objects View">
+      </viewCommandMapping>
+   </extension>
+<!-- start set marker -->
+
+</plugin>
index 7895964773c63c68547bb0b15525b5c50780fab0..8573b617bf11d22d6f23bb7a5941352d0ee4b892 100644 (file)
@@ -22,6 +22,7 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
+import org.eclipse.jface.action.MenuManager;
 import org.eclipse.jface.viewers.CellEditor;
 import org.eclipse.jface.viewers.ICellModifier;
 import org.eclipse.jface.viewers.ISelection;
@@ -33,7 +34,9 @@ import org.eclipse.jface.viewers.TextCellEditor;
 import org.eclipse.jface.viewers.Viewer;
 import org.eclipse.swt.SWT;
 import org.eclipse.swt.widgets.Composite;
+import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Display;
+import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.Table;
 import org.eclipse.ui.IWorkbenchPart;
 
@@ -62,8 +65,6 @@ import eu.etaxonomy.taxeditor.store.CdmStore;
 import eu.etaxonomy.taxeditor.view.AbstractCdmViewPart;
 
 /**
- * <p>ReferencingObjectsView class.</p>
- *
  * @author p.ciardelli
  * @created 08.07.2009
  * @version 1.0
@@ -72,7 +73,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
        private static final Logger logger = Logger
                        .getLogger(ReferencingObjectsView.class);
 
-       /** Constant <code>ID="eu.etaxonomy.taxeditor.bulkeditor.refer"{trunked}</code> */
        public static final String ID = "eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects";
 
        private TableViewer viewer;
@@ -85,9 +85,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
            cdmEntitySession = CdmStore.getCurrentSessionManager().bindNullSession();
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#createViewer(org.eclipse.swt.widgets.Composite)
-        */
        /** {@inheritDoc} */
        @Override
        public void createViewer(Composite parent) {
@@ -99,11 +96,8 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                viewer.setContentProvider(new ReferencingObjectsContentProvider());
                viewer.setLabelProvider(new ReferencingObjectsLabelProvider());
                viewer.setCellModifier(new ICellModifier() {
-
             @Override
             public void modify(Object element, String property, Object value) {
-                // TODO Auto-generated method stub
-
             }
 
             @Override
@@ -126,7 +120,16 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                 return true;
             }
         });
-//             viewer.setInput(new ArrayList<CdmBase>());
+
+        //create context menu
+        MenuManager menuManager = new MenuManager();
+        getSite().registerContextMenu(menuManager, viewer);
+        Control control = viewer.getControl();
+        Menu menu = menuManager.createContextMenu(control);
+        control.setMenu(menu);
+
+        // Propagate selection from viewer
+        getSite().setSelectionProvider(viewer);
        }
 
        /**
@@ -159,11 +162,7 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
        public void setFocus() {
            cdmEntitySession.bind();
        }
-       /**
-        * <p>updateReferencingObjects</p>
-        *
-        * @param entity a {@link eu.etaxonomy.cdm.model.common.IdentifiableEntity} object.
-        */
+
        public void updateReferencingObjects(final UUID entityUUID, final Class objectClass) {
 
                final Display display = Display.getCurrent();
@@ -246,9 +245,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 
        class ReferencingClassComparator implements Comparator<CdmBase> {
 
-               /* (non-Javadoc)
-                * @see java.util.Comparator#compare(java.lang.Object, java.lang.Object)
-                */
                @Override
         public int compare(CdmBase o1, CdmBase o2) {
                        String string1 = o1.getClass().getSimpleName();
@@ -264,9 +260,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                }
        }
 
-       /**
-        *
-        */
        private void updateView(List<CdmBase> referencingObjects) {
                if (viewer != null && !viewer.getControl().isDisposed()){
                        try{
@@ -287,6 +280,9 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
        /** {@inheritDoc} */
        @Override
     public void selectionChanged(IWorkbenchPart part, ISelection selection) {
+        if(part == this){
+            return;
+        }
                if(! (part instanceof BulkEditor)){
                        setContentDescription("");
                        showEmptyPage();
@@ -309,9 +305,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
                showViewer(part, lineSelection);
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#showViewer(org.eclipse.ui.IWorkbenchPart, org.eclipse.jface.viewers.ISelection)
-        */
        /** {@inheritDoc} */
        @Override
        public void showViewer(IWorkbenchPart part, IStructuredSelection selection) {
@@ -331,27 +324,18 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
 
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#getViewer()
-        */
        /** {@inheritDoc} */
        @Override
        public Viewer getViewer() {
                return viewer;
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.model.AbstractCdmViewPart#dirtyStateChanged()
-        */
        /** {@inheritDoc} */
        @Override
        public void changed(Object object) {
                // no editing in this view
        }
 
-       /* (non-Javadoc)
-        * @see eu.etaxonomy.taxeditor.operations.IPostOperationEnabled#onComplete()
-        */
        /** {@inheritDoc} */
        @Override
        public boolean onComplete() {
@@ -359,7 +343,6 @@ public class ReferencingObjectsView extends AbstractCdmViewPart {
        }
 
        public void refresh(){
-
                selectionService.removePostSelectionListener(this);
                selectionService.removeSelectionListener(this);
                selectionService.addPostSelectionListener(this);
index d6cc82eab6afb4ebd88098025c85e00b3b2df4ea..3450b36a5722fb6b8e9498095295bec08982bd4c 100644 (file)
@@ -148,7 +148,7 @@ command.label.54 = Delete (with children)
 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.42 = Open Taxon Editor for taxon\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
index 7cf0948326fe2165c4c2c5a2ac01facb141dd4a9..8ead2c7be1b9f792fc6b4dfb4d4c7b6a1aded81e 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.DefaultOpenTaxonEditorForTaxonHandler"
+            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.DefaultOpenTaxonEditorForTaxonNodeHandler"
+            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"
             defaultHandler="eu.etaxonomy.taxeditor.editor.handler.OpenDerivateViewHandler"
             id="eu.etaxonomy.taxeditor.editor.openSpecimenEditor"
             name="Open Derivative Editor">
-         <commandParameter
-               id="eu.etaxonomy.taxeditor.specimenUuidParameter"
-               name="Specimen UUID parameter"
-               optional="true"
-               typeId="eu.etaxonomy.taxeditor.specimenUuidParameterType">
-         </commandParameter>
       </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.editor.view.derivate.handler.ListenToSelectionChangeHandler"
       </command>
         
    </extension>
-   <extension
-         point="org.eclipse.ui.commands">
-      <commandParameterType
-            converter="eu.etaxonomy.taxeditor.handler.UuidParameterConverter"
-            id="eu.etaxonomy.taxeditor.specimenUuidParameterType"
-            type="java.util.UUID">
-      </commandParameterType>
-   </extension>
    <extension
          point="org.eclipse.core.expressions.definitions">
       <definition
    </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/DefaultOpenTaxonEditorForTaxonHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonHandler.java
new file mode 100644 (file)
index 0000000..03db45a
--- /dev/null
@@ -0,0 +1,33 @@
+package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonService;
+import eu.etaxonomy.cdm.model.taxon.TaxonBase;
+import eu.etaxonomy.taxeditor.editor.EditorUtil;
+import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
+import eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class DefaultOpenTaxonEditorForTaxonHandler extends DefaultOpenHandlerBase<TaxonBase> {
+
+    @Override
+    protected TaxonBase getEntity(UUID uuid) {
+        return CdmStore.getService(ITaxonService.class).load(uuid);
+    }
+
+    @Override
+    protected void open(ExecutionEvent event, TaxonBase entity) {
+        TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(entity.getUuid());
+        try {
+            EditorUtil.open(input);
+        } catch (PartInitException e) {
+            MessagingUtils.error(DefaultOpenTaxonEditorForTaxonHandler.class, "Could not open taxon editor for taxon "+input.getTaxon(), e);
+        }
+    }
+
+}
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonNodeHandler.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/handler/defaultHandler/DefaultOpenTaxonEditorForTaxonNodeHandler.java
new file mode 100644 (file)
index 0000000..52937c8
--- /dev/null
@@ -0,0 +1,33 @@
+package eu.etaxonomy.taxeditor.editor.handler.defaultHandler;
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.ui.PartInitException;
+
+import eu.etaxonomy.cdm.api.service.ITaxonNodeService;
+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.DefaultOpenHandlerBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+
+public class DefaultOpenTaxonEditorForTaxonNodeHandler extends DefaultOpenHandlerBase<TaxonNode> {
+
+    @Override
+    protected TaxonNode getEntity(UUID uuid) {
+        return CdmStore.getService(ITaxonNodeService.class).load(uuid);
+    }
+
+    @Override
+    protected void open(ExecutionEvent event, TaxonNode entity) {
+        TaxonEditorInput input = TaxonEditorInput.NewInstanceFromTaxonBase(entity.getTaxon().getUuid());
+        try {
+            EditorUtil.open(input);
+        } catch (PartInitException e) {
+            MessagingUtils.error(DefaultOpenTaxonEditorForTaxonNodeHandler.class, "Could not open taxon editor for taxon "+input.getTaxon(), e);
+        }
+    }
+
+}
index a6504a980626b40a4448e55fae4ee02630f7b8fb..949980cbb20378f4923fef68fc36a7c3d7e7de26 100644 (file)
@@ -202,6 +202,8 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
 
         //init tree
         updateRootEntities();
+        //reset status bar
+        getEditorSite().getActionBars().getStatusLineManager().setMessage("");
 
         //add drag'n'drop support
         Transfer[] transfers = new Transfer[] {LocalSelectionTransfer.getTransfer(),};
@@ -219,12 +221,13 @@ public class DerivateView extends EditorPart implements IPartContentHasFactualDa
                 conversation.bind();
             }
             /*
-             * If the active session is not the session of the Derivate Editor then we will
-             * save it, bind temporarily to our session and rebind to the original session.
-             * This happens e.g. if a selection change happens in the taxon editor and
-             * "Link with editor" is enabled. The selection change event and thus the
-             * loading in updateRootEntities() happens in the session of the taxon
-             * editor.
+             * If the active session is not the session of the Derivative Editor
+             * then we will save the active session for later, bind temporarily
+             * to our session and rebind to the original session when we are
+             * done. This happens e.g. if a selection change happens in the
+             * taxon editor and "Link with editor" is enabled. The selection
+             * change event and thus the loading in updateRootEntities() happens
+             * in the session of the taxon editor.
              */
             ICdmEntitySession previousCdmEntitySession = CdmStore.getCurrentSessionManager().getActiveSession();
             if(cdmEntitySession != null) {
index 9767c38e9a1f11287aaebd930a234739b1ee91d6..85bdb483836641ab6d19fdd0a49c8158ef069118 100644 (file)
                name="taxeditor-navigation.separator1"
                visible="true">
          </separator>
-         <command
-               commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
-               label="%command.label.5"
-               style="push">       
-            <visibleWhen
-                  checkEnabled="true">
-               <or>
-                  <reference
-                        definitionId="isTaxonNode">
-                  </reference>
-                  <reference
-                        definitionId="isTaxonomicTree">
-                  </reference>
-               </or>
-            </visibleWhen>
-         </command>
-         <command
-               commandId="eu.etaxonomy.taxeditor.store.open"
-               label="Edit"
-               style="push">
-            <visibleWhen
-                  checkEnabled="true">
-               <with
-                     variable="selection">
-                  <reference
-                        definitionId="isClassification">
-                  </reference>
-               </with>
-            </visibleWhen>
-         </command>
+         <dynamic
+               class="eu.etaxonomy.taxeditor.view.CdmViewerContextMenu"
+               id="eu.etaxonomy.taxeditor.navigation.cdmViewerContextMenu">
+         </dynamic>
          <command
                commandId="eu.etaxonomy.taxeditor.navigator.command.update.changeAcceptedToSynonym"
                label="%command.label.6"
    </extension>
    <extension
          point="org.eclipse.ui.commands">
-      <command
-            defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.EditHandler"
-            id="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"
-            name="%command.name.1">
-      </command>
       <command
             defaultHandler="eu.etaxonomy.taxeditor.navigation.navigator.handler.MoveTaxonHandler"
             id="eu.etaxonomy.taxeditor.navigation.command.update.moveTaxon"
          </test>
       </definition>
    </extension>
-   <extension
-         point="eu.etaxonomy.taxeditor.store.cdmViewer">
-      <cdmViewer
-            class="eu.etaxonomy.taxeditor.navigation.NavigationCdmViewer">
-      </cdmViewer>
-   </extension>
 </plugin>
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationCdmViewer.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/NavigationCdmViewer.java
deleted file mode 100644 (file)
index 8ba357d..0000000
+++ /dev/null
@@ -1,43 +0,0 @@
-package eu.etaxonomy.taxeditor.navigation;
-
-import java.util.HashMap;
-import java.util.Map;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.ui.PlatformUI;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-import eu.etaxonomy.taxeditor.view.ICdmViewer;
-
-public class NavigationCdmViewer implements ICdmViewer {
-
-
-    @SuppressWarnings("unused")
-    private final Logger logger = Logger.getLogger(NavigationCdmViewer.class);
-
-    @Override
-    public void show(Object input, Class<?> viewerClass) {
-        if(viewerClass.equals(NewClassificationWizard.class)){
-            if(input instanceof Classification){
-                Classification classification = (Classification)input;
-                NewClassificationWizard classificationWizard = new NewClassificationWizard();
-                classificationWizard.init(null, null);
-                classificationWizard.setEntity(classification);
-                WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
-                dialog.open();
-            }
-        }
-    }
-
-    @Override
-    public Map<Class<?>, String> getViewerClasses(Object input) {
-        Map<Class<?>, String> viewerNameMap = new HashMap<Class<?>, String>();
-        if(input instanceof Classification){
-            viewerNameMap.put(NewClassificationWizard.class, "Classification Wizard");
-        }
-        return viewerNameMap;
-    }
-
-}
index a266c8d9249de70341c8ddebb3d14107d3c44dd8..613dbabb33885f5a9207f5df1f4dcefd966b63c6 100644 (file)
@@ -35,7 +35,6 @@ import eu.etaxonomy.cdm.model.taxon.Synonym;
 import eu.etaxonomy.cdm.model.taxon.Taxon;
 import eu.etaxonomy.cdm.model.taxon.TaxonBase;
 import eu.etaxonomy.cdm.model.taxon.TaxonNode;
-import eu.etaxonomy.cdm.persistence.dto.UuidAndTitleCache;
 import eu.etaxonomy.taxeditor.editor.EditorUtil;
 import eu.etaxonomy.taxeditor.editor.TaxonEditorInput;
 import eu.etaxonomy.taxeditor.editor.internal.TaxeditorEditorPlugin;
@@ -108,23 +107,6 @@ public class NavigationUtil extends AbstractUtility{
                }
        }
 
-       public static void openEditor(Object selectedObject){
-               if (selectedObject instanceof UuidAndTitleCache){
-                       Class type = ((UuidAndTitleCache) selectedObject).getType();
-                       if(type == Taxon.class || type == Synonym.class){
-                               try {
-                                       EditorUtil.openTaxonBase(((UuidAndTitleCache) selectedObject).getUuid());
-                               } catch (PartInitException e) {
-                                       MessagingUtils.error(NavigationUtil.class, "Error opening the editor", e);
-                               }
-                       }
-               }else if(selectedObject instanceof ICdmBase){
-                       openEditor((ICdmBase) selectedObject);
-               }else{
-                       MessagingUtils.error(NavigationUtil.class, new IllegalArgumentException("Selected object is not supported: " + selectedObject));
-               }
-       }
-
        /**
         * <p>openEmpty</p>
         *
diff --git a/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java b/eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java
deleted file mode 100644 (file)
index e4876d3..0000000
+++ /dev/null
@@ -1,89 +0,0 @@
-package eu.etaxonomy.taxeditor.navigation.navigator.handler;
-// $Id$
-/**
-* Copyright (C) 2007 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.
-*/
-
-
-import org.eclipse.core.commands.AbstractHandler;
-import org.eclipse.core.commands.ExecutionEvent;
-import org.eclipse.core.commands.ExecutionException;
-import org.eclipse.core.commands.IHandler;
-import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.Status;
-import org.eclipse.core.runtime.jobs.Job;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.jface.wizard.WizardDialog;
-import org.eclipse.swt.widgets.Display;
-import org.eclipse.ui.handlers.HandlerUtil;
-
-import eu.etaxonomy.cdm.model.taxon.Classification;
-import eu.etaxonomy.taxeditor.navigation.NavigationUtil;
-import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
-
-/**
- * <p>EditHandler class.</p>
- *
- * @author n.hoffmann
- * @created May 12, 2010
- * @version 1.0
- */
-public class EditHandler extends AbstractHandler implements IHandler{
-
-       /* (non-Javadoc)
-        * @see org.eclipse.core.commands.IHandler#execute(org.eclipse.core.commands.ExecutionEvent)
-        */
-       /** {@inheritDoc} */
-       @Override
-    public Object execute(ExecutionEvent event) throws ExecutionException {
-
-               ISelection selection = HandlerUtil.getCurrentSelection(event);
-
-               if(selection instanceof IStructuredSelection){
-                       final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
-
-                       if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
-                               Classification classification = (Classification) structuredSelection.getFirstElement();
-
-                               NewClassificationWizard classificationWizard = new NewClassificationWizard();
-                               classificationWizard.init(null, null);
-                               classificationWizard.setEntity(classification);
-                               WizardDialog dialog = new WizardDialog(HandlerUtil.getActiveShell(event), classificationWizard);
-                               dialog.open();
-
-                       }
-                       else{
-
-                               Job job = new Job("Opening editor") {
-
-                                       @Override
-                                       protected IStatus run(IProgressMonitor monitor) {
-                                               for(final Object selectedObject : structuredSelection.toArray()){
-
-                                                       Display.getDefault().asyncExec(new Runnable(){
-
-                                                               @Override
-                                public void run() {
-                                                                       NavigationUtil.openEditor(selectedObject);
-                                                               }
-
-                                                       });
-                                               }
-                                               return Status.OK_STATUS;
-                                       }
-                               };
-
-                               job.schedule();
-                       }
-               }
-
-               return null;
-       }
-}
index e0e06f0bcb5e7afa6dafc0e8a4a68119e63aac99..17480513828dcc3326fcb36ca39ac6f7bc72d58a 100644 (file)
@@ -15,6 +15,7 @@ Export-Package: eu.etaxonomy.cdm,
  eu.etaxonomy.taxeditor.editor.definedterm.input,
  eu.etaxonomy.taxeditor.featuretree,
  eu.etaxonomy.taxeditor.handler,
+ eu.etaxonomy.taxeditor.handler.defaultHandler,
  eu.etaxonomy.taxeditor.io,
  eu.etaxonomy.taxeditor.io.wizard,
  eu.etaxonomy.taxeditor.labels,
index 8e7a4532b909d73a51bc3ac89db09839fa27f5b1..40bf6eb077055f071d3c7e7537b779fde0ff92d7 100644 (file)
             id="eu.etaxonomy.taxeditor.store.open"
             name="%command.name.15">
       </command>
+      <command
+            defaultHandler="eu.etaxonomy.taxeditor.handler.defaultHandler.DefaultOpenClassificationWizardHandler"
+            id="eu.etaxonomy.taxeditor.command.openClassificationWizard"
+            name="Open Classification Wizard">
+         <commandParameter
+               id="eu.etaxonomy.taxeditor.command.openClassificationWizard.uuid"
+               name="Classification Uuid"
+               optional="true"
+               typeId="eu.etaxonomy.taxeditor.uuidParameterType">
+         </commandParameter>
+      </command>
+   </extension>
+   <extension
+         point="org.eclipse.ui.commands">
+      <commandParameterType
+            converter="eu.etaxonomy.taxeditor.handler.UuidsParameterTypeConverter"
+            id="eu.etaxonomy.taxeditor.uuidParameterType"
+            type="java.util.UUID">
+      </commandParameterType>
    </extension>
    <extension
          point="org.eclipse.ui.importWizards">
       </variable>
    </sourceProvider>
 </extension>
+<extension
+      point="eu.etaxonomy.taxeditor.store.cdmViewer">
+   <viewCommandMapping
+         commandId="eu.etaxonomy.taxeditor.command.openClassificationWizard"
+         selection="eu.etaxonomy.cdm.model.taxon.Classification"
+         viewerName="Classification Wizard">
+   </viewCommandMapping>
+</extension>
 </plugin>
index 42791ec3b89d6c6967cb86041814a7d482ff7619..b233e53f9d3ec4f27bf630e383492765ef7fbdbe 100644 (file)
@@ -21,7 +21,8 @@
       </annotation>
       <complexType>
          <sequence>
-            <element ref="cdmViewer" minOccurs="1" maxOccurs="unbounded"/>
+            <element ref="cdmViewer" minOccurs="0" maxOccurs="unbounded"/>
+            <element ref="viewCommandMapping" minOccurs="0" maxOccurs="unbounded"/>
          </sequence>
          <attribute name="point" type="string" use="required">
             <annotation>
       </complexType>
    </element>
 
+   <element name="viewCommandMapping">
+      <annotation>
+         <documentation>
+            Maps a viewing class, like editors or views, to a command which opens it.
+         </documentation>
+      </annotation>
+      <complexType>
+         <attribute name="commandId" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The command which opens the viewer to show the selected object
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="identifier" basedOn="org.eclipse.ui.commands/command/@id"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+         <attribute name="viewerName" type="string">
+            <annotation>
+               <documentation>
+                  The name of the viewer which shows the selected element
+               </documentation>
+            </annotation>
+         </attribute>
+         <attribute name="selection" type="string" use="required">
+            <annotation>
+               <documentation>
+                  The class of the selected element
+               </documentation>
+               <appInfo>
+                  <meta.attribute kind="java"/>
+               </appInfo>
+            </annotation>
+         </attribute>
+      </complexType>
+   </element>
+
    <annotation>
       <appInfo>
          <meta.section type="since"/>
similarity index 67%
rename from eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/UuidParameterConverter.java
rename to eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/UuidsParameterTypeConverter.java
index 5bd3db11e0cbdc0d3ffac447a90b6eb9343aef56..e23482714f7a82b235ab79c573545ffed87b34ea 100644 (file)
@@ -5,10 +5,17 @@ import java.util.UUID;
 import org.eclipse.core.commands.AbstractParameterValueConverter;
 import org.eclipse.core.commands.ParameterValueConversionException;
 
-public class UuidParameterConverter extends AbstractParameterValueConverter {
+/**
+ * Converts {@link UUID}s to a string representation
+ * and vica versa.
+ *
+ * @author pplitzner
+ * @date Sep 15, 2015
+ *
+ */
+public class UuidsParameterTypeConverter extends AbstractParameterValueConverter {
 
-    public UuidParameterConverter() {
-        // TODO Auto-generated constructor stub
+    public UuidsParameterTypeConverter() {
     }
 
     @Override
@@ -21,4 +28,4 @@ public class UuidParameterConverter extends AbstractParameterValueConverter {
         return parameterValue.toString();
     }
 
-}
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenClassificationWizardHandler.java
new file mode 100644 (file)
index 0000000..879be20
--- /dev/null
@@ -0,0 +1,31 @@
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import java.util.UUID;
+
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.jface.wizard.WizardDialog;
+import org.eclipse.ui.PlatformUI;
+
+import eu.etaxonomy.cdm.api.service.IClassificationService;
+import eu.etaxonomy.cdm.model.taxon.Classification;
+import eu.etaxonomy.taxeditor.newWizard.NewClassificationWizard;
+import eu.etaxonomy.taxeditor.store.CdmStore;
+
+public class DefaultOpenClassificationWizardHandler extends DefaultOpenHandlerBase<Classification> {
+
+    @Override
+    protected Classification getEntity(UUID uuid) {
+        return CdmStore.getService(IClassificationService.class).load(uuid);
+    }
+
+    @Override
+    protected void open(ExecutionEvent event, Classification entity) {
+        NewClassificationWizard classificationWizard = new NewClassificationWizard();
+        classificationWizard.init(null, null);
+        classificationWizard.setEntity(entity);
+        WizardDialog dialog = new WizardDialog(PlatformUI.getWorkbench().getActiveWorkbenchWindow().getShell(), classificationWizard);
+        dialog.open();
+    }
+
+
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenHandlerBase.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/DefaultOpenHandlerBase.java
new file mode 100644 (file)
index 0000000..f96b1c3
--- /dev/null
@@ -0,0 +1,51 @@
+package eu.etaxonomy.taxeditor.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.handlers.HandlerUtil;
+
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
+
+public abstract class DefaultOpenHandlerBase <T> 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)){
+                    T entity = getEntity((UUID) object);
+                    open(event, entity);
+                }
+            } catch (NotDefinedException e) {
+                MessagingUtils.error(DefaultOpenHandlerBase.class, "Error while opening classification!", e);
+            }
+        }
+        //if not try current selection
+        else{
+            ISelection selection = HandlerUtil.getCurrentSelection(event);
+            if(selection instanceof IStructuredSelection){
+                open(event, (T) ((IStructuredSelection) selection).getFirstElement());
+            }
+        }
+        return null;
+    }
+
+
+    protected abstract T getEntity(UUID uuid);
+
+    protected abstract void open(ExecutionEvent event, T entity);
+
+}
\ No newline at end of file
diff --git a/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java b/eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/handler/defaultHandler/OpenReferencingObjectsView.java
new file mode 100644 (file)
index 0000000..88514b9
--- /dev/null
@@ -0,0 +1,16 @@
+package eu.etaxonomy.taxeditor.handler.defaultHandler;
+
+import org.eclipse.core.commands.AbstractHandler;
+import org.eclipse.core.commands.ExecutionEvent;
+import org.eclipse.core.commands.ExecutionException;
+
+import eu.etaxonomy.taxeditor.model.AbstractUtility;
+
+public class OpenReferencingObjectsView extends AbstractHandler {
+
+    @Override
+    public Object execute(ExecutionEvent event) throws ExecutionException {
+        return AbstractUtility.showView("eu.etaxonomy.taxeditor.bulkeditor.view.referencingobjects");
+    }
+
+}
index 6efcc81d0e473e68c40a8168cc60a225bd387092..939f753b698d3874cd784a9a863c1d43c886c09b 100644 (file)
@@ -9,9 +9,13 @@
  */
 package eu.etaxonomy.taxeditor.view;
 
+import java.util.HashMap;
 import java.util.Map;
-import java.util.Map.Entry;
+import java.util.UUID;
 
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.jface.dialogs.PopupDialog;
 import org.eclipse.jface.viewers.ArrayContentProvider;
 import org.eclipse.jface.viewers.ILabelProvider;
@@ -27,6 +31,12 @@ import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Control;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.swt.widgets.Table;
+import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
  * This class opens a popup dialog and provides the possibility to choose from a
@@ -38,8 +48,8 @@ import org.eclipse.swt.widgets.Table;
  */
 public class CdmViewerChooser extends PopupDialog implements ISelectionChangedListener, ILabelProvider{
 
+    private Map<String, String> nameViewerMap;
     private Object input;
-    private Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap;
 
     public CdmViewerChooser(Shell parentShell) {
         this(parentShell, SWT.RESIZE | SWT.ON_TOP, true, false, false, false, false, "Open in ...",
@@ -59,13 +69,12 @@ public class CdmViewerChooser extends PopupDialog implements ISelectionChangedLi
      */
     public void chooseViewer(Object input){
         this.input = input;
-        this.nameViewerMap = CdmViewerUtil.getNameViewerMap(input);
+        this.nameViewerMap = CdmViewerUtil.getAvailableViewers(input);
 
         //if only one editor is available then open it
         if(nameViewerMap.size()==1){
-            Entry<Class<?>, String> next = nameViewerMap.keySet().iterator().next();
-            ICdmViewer cdmViewer = nameViewerMap.get(next);
-            cdmViewer.show(input, next.getKey());
+            String commandId = nameViewerMap.keySet().iterator().next();
+            executeCommand(commandId, input);
         }
         else{
             if(nameViewerMap.isEmpty()){
@@ -75,6 +84,32 @@ public class CdmViewerChooser extends PopupDialog implements ISelectionChangedLi
         }
     }
 
+    private void executeCommand(String commandId, Object input) {
+        ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+        //get the command from plugin.xml
+        Command command = commandService.getCommand(commandId);
+
+        //set uuid parameter
+        if(input instanceof ICdmBase){
+            Map<String, UUID> params = new HashMap<String, UUID>();
+            params.put(commandId+".uuid", ((ICdmBase) input).getUuid());
+
+            //build the parameterized command
+            ParameterizedCommand pc = ParameterizedCommand.generateCommand(command, params);
+
+            if(command.isEnabled()) {
+                IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+                try {
+                    handlerService.executeCommand(pc, null);
+                } catch (NotDefinedException nde) {
+                    throw new RuntimeException("Could not find open command: " + commandId);
+                } catch (Exception exception) {
+                    MessagingUtils.error(getClass(), "An exception occured while trying execute "+commandId, exception);
+                }
+            }
+        }
+    }
+
     @Override
     protected Control createDialogArea(Composite parent) {
         TableViewer viewer = new TableViewer(new Table(parent, SWT.MULTI | SWT.H_SCROLL | SWT.V_SCROLL | SWT.FULL_SELECTION));
@@ -90,10 +125,8 @@ public class CdmViewerChooser extends PopupDialog implements ISelectionChangedLi
         ISelection selection = event.getSelection();
         if(selection instanceof IStructuredSelection){
             Object firstElement = ((IStructuredSelection) selection).getFirstElement();
-            if(nameViewerMap.containsKey(firstElement)){
-                Entry<Class<?>, String> entry = (Entry<Class<?>, String>)firstElement;
-                ICdmViewer cdmViewer = nameViewerMap.get(entry);
-                cdmViewer.show(input, entry.getKey());
+            if(firstElement instanceof String && nameViewerMap.containsKey(firstElement)){
+                executeCommand((String) firstElement, this.input);
                 this.close();
             }
         }
@@ -101,12 +134,7 @@ public class CdmViewerChooser extends PopupDialog implements ISelectionChangedLi
 
     @Override
     public String getText(Object element) {
-        String text = null;
-        if(nameViewerMap.containsKey(element)){
-            Entry<Class<?>, String> entry = (Entry<Class<?>, String>) element;
-            text = entry.getValue();
-        }
-        return text;
+        return nameViewerMap.get(element);
     }
 
     @Override
index 712bec9d8a40c91ee3024b635122163b36d2e5a8..db59d464d01ba40ddfd6c14b3a10fdb4a4b783d1 100644 (file)
@@ -1,8 +1,13 @@
 package eu.etaxonomy.taxeditor.view;
 
+import java.util.HashMap;
 import java.util.Map;
 import java.util.Map.Entry;
+import java.util.UUID;
 
+import org.eclipse.core.commands.Command;
+import org.eclipse.core.commands.ParameterizedCommand;
+import org.eclipse.core.commands.common.NotDefinedException;
 import org.eclipse.jface.action.ContributionItem;
 import org.eclipse.jface.action.IContributionItem;
 import org.eclipse.jface.viewers.ISelection;
@@ -15,6 +20,11 @@ import org.eclipse.swt.widgets.MenuItem;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.eclipse.ui.actions.CompoundContributionItem;
+import org.eclipse.ui.commands.ICommandService;
+import org.eclipse.ui.handlers.IHandlerService;
+
+import eu.etaxonomy.cdm.model.common.ICdmBase;
+import eu.etaxonomy.taxeditor.model.MessagingUtils;
 
 /**
  * Generic context menu for opening elements in the taxeditor.
@@ -28,46 +38,89 @@ public class CdmViewerContextMenu extends CompoundContributionItem {
                 new ContributionItem() {
                     @Override
                     public void fill(Menu menu, int index) {
-                        MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
-                        addItem.setText("Open in...");
-                        Menu addMenu = new Menu(menu);
-                        addItem.setMenu(addMenu);
                         final IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
                         final ISelection selection = window.getActivePage().getSelection();
                         if(selection instanceof IStructuredSelection){
                             Object firstElement = ((IStructuredSelection) selection).getFirstElement();
-                            Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap = CdmViewerUtil.getNameViewerMap(firstElement);
-                            for(Entry<Entry<Class<?>, String>, ICdmViewer> entry:nameViewerMap.entrySet()){
-                                Entry<Class<?>, String> viewerClass = entry.getKey();
-                                MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
-                                menuItem.setText(viewerClass.getValue());
-                                menuItem.addSelectionListener(new OpenInViewerListener(entry.getValue(), firstElement, viewerClass.getKey()));
+                            Map<String, String> availableViewers = CdmViewerUtil.getAvailableViewers(firstElement);
+                            Map<Command, String> enabledCommands = getEnabledCommands(availableViewers);
+
+                            //check if only one or multiple viewers/commands are available
+                            if(enabledCommands.size()==1){
+                                Entry<Command, String> entry = enabledCommands.entrySet().iterator().next();
+                                final Command command = entry.getKey();
+                                String viewerName = entry.getValue();
+
+                                MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
+                                addItem.setText(String.format("Open (%s)", viewerName));
+                                addItem.addSelectionListener(new CommandInvoker(command, firstElement)) ;
+                            }
+                            else if(enabledCommands.size()>1){
+                                MenuItem addItem = new MenuItem(menu, SWT.CASCADE);
+                                addItem.setText("Open in...");
+                                Menu addMenu = new Menu(menu);
+                                addItem.setMenu(addMenu);
+                                for(Entry<Command, String> entry:enabledCommands.entrySet()){
+                                    final Command command = entry.getKey();
+                                    String viewerName = entry.getValue();
+
+                                    MenuItem menuItem = new MenuItem(addMenu, SWT.NONE);
+                                    menuItem.setText(viewerName);
+                                    menuItem.addSelectionListener(new CommandInvoker(command, firstElement)) ;
+                                }
                             }
                         }
                     }
+
                 }
         };
         return contributionItems;
     }
 
-    private class OpenInViewerListener extends SelectionAdapter {
+    private Map<Command, String> getEnabledCommands(Map<String, String> availableViewers) {
+        Map<Command, String> enabledCommands = new HashMap<Command, String>();
+        for(Entry<String, String> entry:availableViewers.entrySet()){
+            final String commandId = entry.getKey();
+            ICommandService commandService = (ICommandService)PlatformUI.getWorkbench().getService(ICommandService.class);
+            Command command = commandService.getCommand(commandId);
+            if(command.isEnabled()){
+                enabledCommands.put(command, entry.getValue());
+            }
+        }
+        return enabledCommands;
+    }
 
-        private final ICdmViewer cdmViewer;
-        private final Object input;
-        private final Class<?> viewerClass;
+    private final class CommandInvoker extends SelectionAdapter {
+        private final Command command;
+        private final Object selectedObject;
 
-        public OpenInViewerListener(ICdmViewer cdmViewer, Object input, Class<?> viewerClass) {
-            super();
-            this.cdmViewer = cdmViewer;
-            this.input = input;
-            this.viewerClass = viewerClass;
+        private CommandInvoker(Command command, Object selectedObject) {
+            this.command = command;
+            this.selectedObject = selectedObject;
         }
 
         @Override
         public void widgetSelected(SelectionEvent e) {
-            cdmViewer.show(input, viewerClass);
+            IHandlerService handlerService = (IHandlerService)PlatformUI.getWorkbench().getService(IHandlerService.class);
+            Map<String, UUID> params = new HashMap<String, UUID>();
+            if(selectedObject instanceof ICdmBase){
+                params.put(command.getId()+".uuid", ((ICdmBase) selectedObject).getUuid());
+            }
+            ParameterizedCommand parameterizedCommand = ParameterizedCommand.generateCommand(command, params);
+            try {
+                if(parameterizedCommand!=null){
+                    handlerService.executeCommand(parameterizedCommand, null);
+                }
+                else{
+                    handlerService.executeCommand(command.getId(), null);
+                }
+            } catch (NotDefinedException nde) {
+                throw new RuntimeException("Could not find open command: " + command.getId());
+            } catch (Exception exception) {
+                MessagingUtils.error(getClass(), "An exception occured while trying execute "+command.getId(), exception);
+            }
+            PlatformUI.getWorkbench().getActiveWorkbenchWindow().getActivePage().getSelection();
         }
-
     }
 
 }
index 6f5c6f67ab73666cdc2aec92a0f81f8c881aedca..370195ba0c5b4c0ecd386f8137e2fa92a7a6ff09 100644 (file)
@@ -11,49 +11,53 @@ package eu.etaxonomy.taxeditor.view;
 
 import java.util.HashMap;
 import java.util.Map;
-import java.util.Map.Entry;
 
-import org.eclipse.core.runtime.CoreException;
 import org.eclipse.core.runtime.IConfigurationElement;
 import org.eclipse.core.runtime.IExtensionRegistry;
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
 
 import eu.etaxonomy.taxeditor.model.MessagingUtils;
-import eu.etaxonomy.taxeditor.store.internal.TaxeditorStorePlugin;
 
 /**
+ * Scans eu.etaxonomy.taxeditor.store.cdmViewer extension point.
  * @author pplitzner
  * @date Jul 7, 2015
  *
  */
 public class CdmViewerUtil {
 
-    public static  Map<Entry<Class<?>, String>, ICdmViewer> getNameViewerMap(Object input){
-        Map<Entry<Class<?>, String>, ICdmViewer> nameViewerMap = new HashMap<Entry<Class<?>, String>, ICdmViewer>();
-    
-        IExtensionRegistry reg = Platform.getExtensionRegistry();
-        IConfigurationElement[] extensions = reg
-                .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
-        for (IConfigurationElement configElement : extensions) {
-            try {
-                Object object = configElement.createExecutableExtension("class");
-                if(object instanceof ICdmViewer){
-                    ICdmViewer cdmViewer = (ICdmViewer)object;
-                    Map<Class<?>, String> viewerClasses = cdmViewer.getViewerClasses(input);
-                    for (Entry<Class<?>, String> entry : viewerClasses.entrySet()) {
-                        nameViewerMap.put(entry, cdmViewer);
+    /**
+     * Returns a map of available commands to open the given input.
+     * Keys are the command IDs and values are their string representations.
+     *
+     * @param input
+     *            the object which should be handled by the available commands
+     * @return a key-value map of available commands and their string
+     *         representation
+     */
+    public static  Map<String, String> getAvailableViewers(Object input){
+        Map<String, String> commandViewerNameMap = new HashMap<String, String>();
+
+        if(input!=null){
+            IExtensionRegistry reg = Platform.getExtensionRegistry();
+            IConfigurationElement[] extensions = reg
+                    .getConfigurationElementsFor("eu.etaxonomy.taxeditor.store.cdmViewer");
+            for (IConfigurationElement configElement : extensions) {
+                if(configElement.getName().equals("viewCommandMapping")){
+                    try {
+                        String commandId = configElement.getAttribute("commandId");
+                        String viewerName = configElement.getAttribute("viewerName");
+                        Class<?> selectionClass = Class.forName(configElement.getAttribute("selection"));
+                        if(selectionClass.isAssignableFrom(input.getClass())){
+                            commandViewerNameMap.put(commandId, viewerName);
+                        }
+                    } catch (ClassNotFoundException e) {
+                        MessagingUtils.error(CdmViewerChooser.class, "Could not initalize selection class element of cdmViewer extension", e);
                     }
                 }
-                else{
-                    MessagingUtils.error(CdmViewerChooser.class, new Status(IStatus.ERROR, TaxeditorStorePlugin.PLUGIN_ID, "Could not load cdmViewer extension"));
-                }
-            } catch (CoreException e) {
-                MessagingUtils.error(CdmViewerChooser.class, "Could not load cdmViewer extension", e);
             }
         }
-        return nameViewerMap;
+        return commandViewerNameMap;
     }
 
 }