translate some commands
authorKatja Luther <k.luther@bgbm.org>
Tue, 19 Jul 2016 10:22:27 +0000 (12:22 +0200)
committerKatja Luther <k.luther@bgbm.org>
Tue, 19 Jul 2016 10:22:27 +0000 (12:22 +0200)
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.editor/plugin.xml
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/GroupBasionymContributionItem.java [deleted file]
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/NameEditorMenuPropertyTester.java

index 486622a6c7750b70ccfcd02b0aca1731b0be891b..e3f0fba1cf1b1be50e33e8337355f841447d14dc 100644 (file)
@@ -153,6 +153,9 @@ command.name.43 = Create Field Unit
 command.name.44 = Deep Delete\r
 command.name.46 = Move Synonym (Homotypical Group) to another Accepted Taxon\r
 command.label.56 = Move Synonym (Homotypical Group) to another Accepted Taxon\r
+command.name.57 = Set as Basionym of Homotypical Group\r
+command.label.57 = Set as Basionym of Homotypical Group\r
+\r
 markerContentGenerator.name = Validation Problems Marker Generator\r
 command.name.45 = Delete\r
 command.name.47 = Delete\r
index 01c978e1a063bf9a92b39abe0bf7bc0ad2162bad..8c3d36882a4badb1fb468032366e0f19258aa480 100644 (file)
@@ -26,7 +26,7 @@ command.label.5 = Medien
 command.label.6 = Konzeptrelationen
 command.label.7 = Konzeptgraph
 command.label.8 = \u00d6ffne Parent
-menu.label = Neue
+menu.label = Neu
 command.label.9 = Heterotypisches Synonym
 command.label.10 = Homotypisches Synonym
 command.label.11 = Synonym in Homotypischer Gruppe
@@ -68,6 +68,7 @@ menu.label.3 = Neue
 command.label.43 = \u00d6ffne verbundenes Konzept
 command.label.44 = L\u00f6schen
 command.label.45 = Bearbeite Rechte
+command.label.57 = Setze als Basionym der homotypischen Gruppe
 extension.name = Namensbefehle
 category.name.0 = -- Namenseditor
 command.name = \u00d6ffne Elter
@@ -162,6 +163,7 @@ command.name.48 = L\u00f6schen
 command.name.49 = L\u00f6schen
 command.name.50 = L\u00f6schen
 command.name.51 = L\u00f6schen
+command.name.57 = Setze als Basionym
 
 editor.name.DERIVATIVE_EDITOR = Specimen-Editor
 command.label.DERIVATIVE_EDITOR = Specimen-Editor
index 83c8015b8108b114ed804308bc6c98ed9d453a4b..ff295745290b3980ac2596f3f89fa39cfdfdccbd 100644 (file)
                      definitionId="isSynonym">
                </reference>
             </visibleWhen>
+         </command>
+          <command
+               commandId="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
+               label="%command.label.57"
+               style="push">
+            <visibleWhen>
+              <reference
+                     definitionId="isSynonymInHomotypicalGroupWithMoreSynonyms">
+               </reference>
+           </visibleWhen>
          </command>
          <command
                   commandId="eu.etaxonomy.taxeditor.editor.name.moveSynonymToAnotherAcceptedTaxon"
             defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SwapSynonymAndAcceptedHandler"
             id="eu.etaxonomy.taxeditor.editor.name.swapSynonymAndAccepted"
             name="%command.name.6">
+      </command>
+       <command
+            categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
+            defaultHandler="eu.etaxonomy.taxeditor.editor.name.handler.SetBasionymHandler"
+            id="eu.etaxonomy.taxeditor.editor.name.setAsBasionym"
+            name="%command.name.57">
       </command>
       <command
             categoryId="eu.etaxonomy.taxeditor.editor.taxon.name.command.category"
                   property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isNotHomotypicSynonymOfAcceptedTaxon">
             </test>
          </with>
+      </definition>
+       <definition
+            id="isSynonymInHomotypicalGroupWithMoreSynonyms">
+         <with
+               variable="selection">
+            <test
+                  property="eu.etaxonomy.taxeditor.editor.name.propertyTester.isSynonymInHomotypicalGroupWithMoreSynonyms">
+            </test>
+         </with>
       </definition>
       <definition
             id="isSynonym">
             class="eu.etaxonomy.taxeditor.editor.name.handler.NameEditorMenuPropertyTester"
             id="eu.etaxonomy.taxeditor.editor.name.propertyTester"
             namespace="eu.etaxonomy.taxeditor.editor.name.propertyTester"
-            properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon"
+            properties="isAcceptedTaxon,isSynonym,isMisapplication,isTaxonBase,hasEmptyNames,isAcceptedAndHasNoHomotypicSynonyms,isNotHomotypicSynonymOfAcceptedTaxon,isSynonymInHomotypicalGroupWithMoreSynonyms"
             type="org.eclipse.jface.viewers.IStructuredSelection">
       </propertyTester>
       <propertyTester
diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/GroupBasionymContributionItem.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/name/handler/GroupBasionymContributionItem.java
deleted file mode 100644 (file)
index 0f42bf5..0000000
+++ /dev/null
@@ -1,107 +0,0 @@
-/**
- * 
- */
-package eu.etaxonomy.taxeditor.editor.name.handler;
-
-import org.apache.log4j.Logger;
-import org.eclipse.jface.action.IContributionItem;
-import org.eclipse.jface.viewers.ISelection;
-import org.eclipse.jface.viewers.IStructuredSelection;
-import org.eclipse.swt.SWT;
-import org.eclipse.ui.ISelectionService;
-import org.eclipse.ui.IWorkbenchWindow;
-import org.eclipse.ui.PlatformUI;
-import org.eclipse.ui.actions.CompoundContributionItem;
-import org.eclipse.ui.menus.CommandContributionItem;
-import org.eclipse.ui.menus.CommandContributionItemParameter;
-
-import eu.etaxonomy.cdm.hibernate.HibernateProxyHelper;
-import eu.etaxonomy.cdm.model.name.NameRelationshipType;
-import eu.etaxonomy.cdm.model.name.TaxonNameBase;
-import eu.etaxonomy.cdm.model.taxon.TaxonBase;
-import eu.etaxonomy.taxeditor.labels.ILabelImageStrategy;
-import eu.etaxonomy.taxeditor.labels.LabelImageProvider;
-
-/**
- * <p>GroupBasionymContributionItem class.</p>
- *
- * @author p.ciardelli
- * @version $Id: $
- */
-public class GroupBasionymContributionItem extends CompoundContributionItem {
-       @SuppressWarnings("unused")
-       private static final Logger logger = Logger.getLogger(GroupBasionymContributionItem.class);
-
-       /**
-        * <p>Constructor for GroupBasionymContributionItem.</p>
-        */
-       public GroupBasionymContributionItem() {}
-
-       /**
-        * <p>Constructor for GroupBasionymContributionItem.</p>
-        *
-        * @param id a {@link java.lang.String} object.
-        */
-       public GroupBasionymContributionItem(String id) {
-               super(id);
-       }
-       
-
-       /** {@inheritDoc} */
-       @Override
-       protected IContributionItem[] getContributionItems() {
-               
-               IWorkbenchWindow window = PlatformUI.getWorkbench().getActiveWorkbenchWindow();
-               
-               ISelectionService selectionService = window.getSelectionService();
-               
-               ISelection selection = selectionService.getSelection();
-               
-               if(selection instanceof IStructuredSelection){
-                       Object selectedObject = ((IStructuredSelection) selection).getFirstElement();
-                       
-                       if(selectedObject != null && selectedObject instanceof TaxonBase){
-                               
-                               TaxonNameBase name = (TaxonNameBase) HibernateProxyHelper.deproxy(((TaxonBase) selectedObject).getName());
-                               
-                               if(name != null && name.getHomotypicalGroup().getTypifiedNames().size() > 1){
-                               
-                                       CommandContributionItemParameter parameter = 
-                                               new CommandContributionItemParameter(
-                                                               window, null, getCommand(name), SWT.NONE);
-                                       
-                                       parameter.label = getLabel(name);               
-                                                       
-                                       return new IContributionItem[] {
-                                                       new CommandContributionItem(parameter)
-                                       };
-                               }
-                               
-                       }
-               }
-               
-               return new IContributionItem[]{};
-       }
-
-       /**
-        * @param name
-        * @return
-        */
-       private String getCommand(TaxonNameBase name) {
-               if(name.isGroupsBasionym()){
-                       return "eu.etaxonomy.taxeditor.editor.name.removeBasionym" ;
-               }
-               return "eu.etaxonomy.taxeditor.editor.name.setBasionym";
-       }
-
-       /**
-        * @param name
-        * @return
-        */
-       private String getLabel(TaxonNameBase name) {
-               ILabelImageStrategy strategy = LabelImageProvider.getLabelStrategy(name);
-               LabelImageProvider labelProvider = new LabelImageProvider(strategy);
-               return (name.isGroupsBasionym() ? "Remove" : "Set")
-                       + " as " + labelProvider.getNameRelationTypeDescription(NameRelationshipType.BASIONYM()) + " for Homotypic Group";
-       }
-}
index 85693469820c39d88c4993f5a16f9ef0d5ada961..f8a49eb0102a07649298039f75ce2b6cc38346be 100644 (file)
@@ -36,7 +36,7 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
        private static final String EMPTY_NAMES = "hasEmptyNames";
        private static final String ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS = "isAcceptedAndHasNoHomotypicSynonyms";
        private static final String NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED = "isNotHomotypicSynonymOfAcceptedTaxon";
-
+       private static final String SYNONYM_WITH_HOMOTYPIC_SYNONYMS = "isSynonymInHomotypicalGroupWithMoreSynonyms";
 
        /**
         * <p>Constructor for NameEditorMenuPropertyTester.</p>
@@ -78,9 +78,13 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
                        }
                        else if(ACCEPTED_AND_NO_HOMOTYPIC_SYNONYMS.equals(property)){
                                return isAcceptedAndHasNoHomotypicSynonyms(selectedElement);
-                       }else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){
+                       }
+                       else if (NOT_HOMOTYPIC_SYNONYM_OF_ACCEPTED.equals(property)){
                                return isNotHomotypicSynonymOfAcceptedTaxon(selectedElement);
                        }
+                       else if (SYNONYM_WITH_HOMOTYPIC_SYNONYMS.equals(property)){
+                               return isSynonymInHomotypicalGroupWithMoreSynonyms(selectedElement);
+                       }
 
                }
 
@@ -95,6 +99,15 @@ public class NameEditorMenuPropertyTester extends org.eclipse.core.expressions.P
                }
                return false;
        }
+       
+       private boolean isSynonymInHomotypicalGroupWithMoreSynonyms(Object selectedElement) {
+               if (isSynonym(selectedElement)){
+                       Synonym synonym = (Synonym) selectedElement;
+                       return synonym.getHomotypicGroup().getTypifiedNames().size()>1;
+               }
+               return false;
+       }
+
 
        private boolean isNotHomotypicSynonymOfAcceptedTaxon(Object selectedElement) {
                if (isSynonym(selectedElement)){