- added Open in Taxon Editor command to Taxon Bulk Editor (#4536)
authorPatric Plitzner <p.plitzner@bgbm.org>
Mon, 23 Feb 2015 17:21:28 +0000 (17:21 +0000)
committerPatric Plitzner <p.plitzner@bgbm.org>
Mon, 23 Feb 2015 17:21:28 +0000 (17:21 +0000)
.gitattributes
eu.etaxonomy.taxeditor.bulkeditor/plugin.xml
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/PropertyTester.java [deleted file]
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorPropertyTester.java
eu.etaxonomy.taxeditor.navigation/src/main/java/eu/etaxonomy/taxeditor/navigation/navigator/handler/EditHandler.java

index 0d1701f0053cf14073b127943d181542d1d405e1..7530a1c505e2022fd76862d4629bdd9933ce0168 100644 (file)
@@ -82,7 +82,6 @@ eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkedito
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorViewerConfiguration.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/IBulkEditorConstants.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/IBulkEditorSortProvider.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/BulkEditorViewerConfiguration.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/IBulkEditorConstants.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/IBulkEditorSortProvider.java -text
-eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/PropertyTester.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorPropertyTester.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DeleteObjectContributionItem.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicMarkerTypeEditingMenu.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/BulkEditorPropertyTester.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DeleteObjectContributionItem.java -text
 eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/command/DynamicMarkerTypeEditingMenu.java -text
index fc783f268763cdcb999e8fde1f9b5b1911ce4aef..1d9437f8b0509e27f4409b45f50bf7794315279e 100644 (file)
       </menuContribution>\r
       <menuContribution\r
             locationURI="popup:#BulkEditorContext">\r
       </menuContribution>\r
       <menuContribution\r
             locationURI="popup:#BulkEditorContext">\r
+         <command\r
+               commandId="eu.etaxonomy.taxeditor.navigation.command.update.editSelection"\r
+               label="Edit"\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
          <menu\r
                label="%menu.label.1">\r
             <dynamic\r
             </visibleWhen>\r
          </menu>\r
          <separator\r
             </visibleWhen>\r
          </menu>\r
          <separator\r
-               name="taxeditor-bulkeditor.separator1"\r
-               visible="true">\r
+               name="eu.etaxonomy.taxeditor.bulkeditor.separator1">\r
          </separator>\r
          <command\r
                commandId="bulkeditor.commands.setmergetarget"\r
          </separator>\r
          <command\r
                commandId="bulkeditor.commands.setmergetarget"\r
             </test>\r
          </with>\r
       </definition>\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
    </extension>\r
    <extension\r
          point="org.eclipse.core.expressions.propertyTesters">\r
    </extension>\r
    <extension\r
          point="org.eclipse.core.expressions.propertyTesters">\r
             class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"\r
             id="taxeditor-bulkeditor.PropertyTester"\r
             namespace="taxeditor-bulkeditor.propertyTester"\r
             class="eu.etaxonomy.taxeditor.bulkeditor.command.BulkEditorPropertyTester"\r
             id="taxeditor-bulkeditor.PropertyTester"\r
             namespace="taxeditor-bulkeditor.propertyTester"\r
-            properties="isMergingEnabled"\r
-            type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
-      </propertyTester>\r
-      <propertyTester\r
-            class="eu.etaxonomy.taxeditor.bulkeditor.PropertyTester"\r
-            id="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
-            namespace="eu.etaxonomy.taxeditor.bulkeditor.propertyTester"\r
-            properties="isDerivedUnitEditor"\r
+            properties="isMergingEnabled, isDerivedUnitEditor, isTaxonEditor, isGroupEditor"\r
             type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
       </propertyTester>\r
    </extension>\r
             type="eu.etaxonomy.taxeditor.bulkeditor.BulkEditor">\r
       </propertyTester>\r
    </extension>\r
diff --git a/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/PropertyTester.java b/eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/PropertyTester.java
deleted file mode 100644 (file)
index fe5333c..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-
-package eu.etaxonomy.taxeditor.bulkeditor;
-
-import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
-
-public class PropertyTester extends org.eclipse.core.expressions.PropertyTester {
-
-       public static final String IS_DERIVED_UNIT_EDITOR = "isDerivedUnitEditor";
-       
-       @Override
-       public boolean test(Object receiver, String property, Object[] args,
-                       Object expectedValue) {
-               
-               BulkEditor editor = (BulkEditor) receiver;
-               
-               if(IS_DERIVED_UNIT_EDITOR.equals(property)){
-                       return editor.getEditorInput() instanceof OccurrenceEditorInput;
-               }
-               
-               return false;
-       }
-
-}
index acc7a08c9927192df6e8c6d5f057af4e6fb3dbb7..0d3efd55b2c4d688f58a0658f2f1b43516352116 100644 (file)
@@ -1,9 +1,9 @@
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
 // $Id$
 /**
 * Copyright (C) 2007 EDIT
-* European Distributed Institute of Taxonomy 
+* European Distributed Institute of Taxonomy
 * http://www.e-taxonomy.eu
 * 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.
 */
 * 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.
 */
@@ -12,16 +12,13 @@ package eu.etaxonomy.taxeditor.bulkeditor.command;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.expressions.PropertyTester;
 
 import org.apache.log4j.Logger;
 import org.eclipse.core.expressions.PropertyTester;
-import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.ui.IEditorInput;
 
 import org.eclipse.ui.IEditorInput;
 
-import eu.etaxonomy.cdm.model.common.Group;
-import eu.etaxonomy.cdm.model.occurrence.DerivedUnit;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditor;
 import eu.etaxonomy.taxeditor.bulkeditor.input.AbstractBulkEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.GroupEditorInput;
 import eu.etaxonomy.taxeditor.bulkeditor.input.OccurrenceEditorInput;
-import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
+import eu.etaxonomy.taxeditor.bulkeditor.input.TaxonEditorInput;
 
 /**
  * <p>BulkEditorPropertyTester class.</p>
 
 /**
  * <p>BulkEditorPropertyTester class.</p>
@@ -31,33 +28,41 @@ import eu.etaxonomy.taxeditor.ui.section.description.DerivedUnitElement;
  * @version 1.0
  */
 public class BulkEditorPropertyTester extends PropertyTester {
  * @version 1.0
  */
 public class BulkEditorPropertyTester extends PropertyTester {
-       private static final Logger logger = Logger
+
+    @SuppressWarnings("unused")
+    private static final Logger logger = Logger
                        .getLogger(BulkEditorPropertyTester.class);
 
                        .getLogger(BulkEditorPropertyTester.class);
 
-       private static final String GROUP = "isGroup";
-       private static final String DERIVEDUNIT = "isDerivedUnit";
+       private static final String IS_MERGING_ENABLED = "isMergingEnabled";
+
+       private static final String IS_GROUP_EDITOR = "isGroupEditor";
+    public static final String IS_DERIVED_UNIT_EDITOR = "isDerivedUnitEditor";
+    public static final String IS_TAXON_EDITOR = "isTaxonEditor";
+
        /* (non-Javadoc)
         * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
         */
        /** {@inheritDoc} */
        /* (non-Javadoc)
         * @see org.eclipse.core.expressions.IPropertyTester#test(java.lang.Object, java.lang.String, java.lang.Object[], java.lang.Object)
         */
        /** {@inheritDoc} */
-       public boolean test(Object receiver, String property, Object[] args,
+       @Override
+    public boolean test(Object receiver, String property, Object[] args,
                        Object expectedValue) {
                BulkEditor bulkEditor = (BulkEditor) receiver;
                        Object expectedValue) {
                BulkEditor bulkEditor = (BulkEditor) receiver;
-                       
-               if ("isMergingEnabled".equals(property)) {                      
+
+               if (IS_MERGING_ENABLED.equals(property)) {
                        IEditorInput input = bulkEditor.getEditorInput();
                        if (input instanceof AbstractBulkEditorInput) {
                        IEditorInput input = bulkEditor.getEditorInput();
                        if (input instanceof AbstractBulkEditorInput) {
-                               return ((AbstractBulkEditorInput) input).isMergingEnabled();
-                       }                       
+                               return ((AbstractBulkEditorInput<?>) input).isMergingEnabled();
+                       }
                }
                }
-               if(GROUP.equals(property)){
-                       return isGroup(bulkEditor);
+               else if(IS_GROUP_EDITOR.equals(property)){
+                       return bulkEditor.getEditorInput() instanceof GroupEditorInput;
                }
                }
-               
-               if (DERIVEDUNIT.equals(property)){
-                       
-                       return isDerivedUnit(bulkEditor);
+               else if (IS_DERIVED_UNIT_EDITOR.equals(property)){
+            return bulkEditor.getEditorInput() instanceof OccurrenceEditorInput;
                }
                }
+        else if(IS_TAXON_EDITOR.equals(property)){
+            return bulkEditor.getEditorInput() instanceof TaxonEditorInput;
+        }
 //             if (("isPublishFlagEditingEnabled").equals(property)) {
 //                     IEditorInput input = bulkEditor.getEditorInput();
 //                     if (input instanceof NameEditorInput) {
 //             if (("isPublishFlagEditingEnabled").equals(property)) {
 //                     IEditorInput input = bulkEditor.getEditorInput();
 //                     if (input instanceof NameEditorInput) {
@@ -66,14 +71,4 @@ public class BulkEditorPropertyTester extends PropertyTester {
 //             }
                return false;
        }
 //             }
                return false;
        }
-       
-       private boolean isDerivedUnit(BulkEditor bulkEditor) {
-               IEditorInput input = bulkEditor.getEditorInput();
-               return (input instanceof OccurrenceEditorInput) ? true : false;
-       }
-
-       private boolean isGroup(BulkEditor bulkEditor) {
-               IEditorInput input = bulkEditor.getEditorInput();
-               return (input instanceof GroupEditorInput) ? true : false;
-       }
 }
 }
index 917f5f40d7e0f3dcbe9b2a77e193f320be22c93e..e4876d35aa3674ea5f1e2cf3a543492cc294fb67 100644 (file)
@@ -19,7 +19,7 @@ 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.core.runtime.Status;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.StructuredSelection;
+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 org.eclipse.jface.wizard.WizardDialog;
 import org.eclipse.swt.widgets.Display;
 import org.eclipse.ui.handlers.HandlerUtil;
@@ -46,8 +46,8 @@ public class EditHandler extends AbstractHandler implements IHandler{
 
                ISelection selection = HandlerUtil.getCurrentSelection(event);
 
 
                ISelection selection = HandlerUtil.getCurrentSelection(event);
 
-               if(selection instanceof StructuredSelection){
-                       final StructuredSelection structuredSelection = (StructuredSelection) selection;
+               if(selection instanceof IStructuredSelection){
+                       final IStructuredSelection structuredSelection = (IStructuredSelection) selection;
 
                        if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
                                Classification classification = (Classification) structuredSelection.getFirstElement();
 
                        if(structuredSelection.size() == 1 && structuredSelection.getFirstElement() instanceof Classification){
                                Classification classification = (Classification) structuredSelection.getFirstElement();