ref #8785: tabel does not need to be configured completely new for new specimen
authorKatja Luther <k.luther@bgbm.org>
Wed, 3 Jun 2020 16:07:02 +0000 (18:07 +0200)
committerKatja Luther <k.luther@bgbm.org>
Wed, 3 Jun 2020 16:07:02 +0000 (18:07 +0200)
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin.properties
eu.etaxonomy.taxeditor.editor/OSGI-INF/l10n/plugin_de.properties
eu.etaxonomy.taxeditor.editor/fragment.e4xmi
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrixHeaderMenuConfiguration.java
eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/handler/AddDescriptionHandler.java

index 92166feb6f87d2f304a87ac4f1e31bb8c92d9536..90214693b2172808eadfa681c0af3a59aca3f206 100755 (executable)
@@ -269,3 +269,4 @@ handledmenuitem.label.27 = Delete
 handledmenuitem.label.28 = Delete Description\r
 partdescriptor.label.6 = Distribution Editor\r
 command.commandname.24 = Delete description\r
+command.commandname.25 = Add description
\ No newline at end of file
index f9fc3376772f6e73a0315545df993eb2da2cf732..7f4c94c122b86821456508f43254a44a17f7cce8 100644 (file)
@@ -269,3 +269,4 @@ handledmenuitem.label.27 = L
 handledmenuitem.label.28 = Beschreibung löschen
 partdescriptor.label.6 = Distribution Editor
 command.commandname.24 = Beschreibung löschen
+command.commandname.25 = Beschreibung zufügen
\ No newline at end of file
index bdf089e55b0d68141bba7a2103aeff662b5d737b..48871f5b27f561eccf55ac4e9889753c0b23e15d 100644 (file)
       <handlers xmi:id="_d_HUYOPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.handler.2" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.view.charactermatrix.handler.ExportCharacterMatrixHandler" command="_YeWagOPBEeeIH8IplZ0cuA"/>
       <handlers xmi:id="_mUM1cLKVEeikjKoOnLFm2w" elementId="eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.CreateDefaultTaxonDescriptionHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.CreateDefaultTaxonDescriptionHandler" command="_ZHC3oLKVEeikjKoOnLFm2w"/>
       <handlers xmi:id="_t8dAQLKVEeikjKoOnLFm2w" elementId="eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.CreateLiteratureTaxonDescriptionHandler" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.CreateLiteratureTaxonDescriptionHandler" command="_fkPkkLKVEeikjKoOnLFm2w"/>
+      <handlers xmi:id="_EbmggKAFEeqsyb5erE_VKQ" elementId="eu.etaxonomy.taxeditor.editor.handler.4" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.handler.AddDescriptionHandler" command="_zCGQ8JN1EeqyUKRuXQ8miw"/>
       <menus xmi:id="_PLw00OPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.menu.characterMatrix" label="%menu.label.7">
         <children xsi:type="menu:HandledMenuItem" xmi:id="_TGK04OPBEeeIH8IplZ0cuA" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.characterMatrix.export" label="%handledmenuitem.label.12" iconURI="platform:/plugin/eu.etaxonomy.taxeditor.store/icons/export.gif" command="_YeWagOPBEeeIH8IplZ0cuA"/>
       </menus>
         <children xsi:type="menu:HandledMenuItem" xmi:id="_AyHbgLKSEeikjKoOnLFm2w" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.createdefaultdescription" label="%handledmenuitem.label.19" command="_ZHC3oLKVEeikjKoOnLFm2w"/>
         <children xsi:type="menu:HandledMenuItem" xmi:id="_DYlHcLKSEeikjKoOnLFm2w" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.createliteraturedescription" label="%handledmenuitem.label.20" command="_fkPkkLKVEeikjKoOnLFm2w"/>
         <children xsi:type="menu:HandledMenuItem" xmi:id="__SlnwI97EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.deletedescription" label="%handledmenuitem.label.28" command="_MYd44I98EeqyUKRuXQ8miw"/>
-        <children xsi:type="menu:HandledMenuItem" xmi:id="_oyS1EJN1EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.adddescription" label="Add description" command="_gE3lwIGyEeehlNPrK_b5JA"/>
+        <children xsi:type="menu:HandledMenuItem" xmi:id="_ARo78KSvEeq8Gc-K2nsNRg" elementId="eu.etaxonomy.taxeditor.editor.handledmenuitem.adddescription" label="Add description" command="_zCGQ8JN1EeqyUKRuXQ8miw"/>
       </menus>
     </elements>
     <elements xsi:type="basic:PartDescriptor" xmi:id="_XcQMEN8mEee9zP45RW4C3A" elementId="eu.etaxonomy.taxeditor.editor.descriptiveDataSet.DescriptiveDataSetNavigator" label="%partdescriptor.label.5" closeable="true" contributionURI="bundleclass://eu.etaxonomy.taxeditor.editor/eu.etaxonomy.taxeditor.editor.descriptiveDataSet.DescriptiveDataSetNavigator">
     <elements xsi:type="commands:Command" xmi:id="_yknsIL9NEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.e4.handler.MoveDescriptionToOtherTaxonHandlerSetNameInSource" commandName="%command.name.131"/>
     <elements xsi:type="commands:Command" xmi:id="__8WFwL9OEemCian_vXpNsA" elementId="eu.etaxonomy.taxeditor.editor.view.descriptive.command.moveDescriptionElementsSetNameInSource" commandName="%command.name.132"/>
     <elements xsi:type="commands:Command" xmi:id="_MYd44I98EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.command.deletedescription" commandName="%command.commandname.24"/>
-    <elements xsi:type="commands:Command" xmi:id="_zCGQ8JN1EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.handler.addDescription" commandName="Add description"/>
+    <elements xsi:type="commands:Command" xmi:id="_zCGQ8JN1EeqyUKRuXQ8miw" elementId="eu.etaxonomy.taxeditor.editor.charactermatrix.command.addDescription" commandName="%command.commandname.25"/>
   </fragments>
   <fragments xsi:type="fragment:StringModelFragment" xmi:id="_pZmusEalEeeXMc6kSYO7Xg" featurename="children" parentElementId="eu.etaxonomy.taxeditor.menu.showView" positionInList="after:eu.etaxonomy.taxeditor.workbench.menuseparator.navigation">
     <elements xsi:type="menu:HandledMenuItem" xmi:id="_FPIHQKNwEeebGZ23ERGMGw" elementId="eu.etaxonomy.taxeditor.editor.showViewMenu.conceptGraph" label="%view.name.3" iconURI="" tooltip="%view.name.3" command="_WPjpoDSnEeek0dKsFNy--Q">
index 823b81ad7d6833082d0e476504807c8fc8e3ca38..ba3f610c2d29bb83ede754c6f2e50dc2ad0d33d5 100644 (file)
@@ -195,6 +195,8 @@ public class CharacterMatrix extends Composite {
 
     private List<SpecimenNodeWrapper> specimenToAdd;
 
+    private MouseEventMatcher mouseEventMatcher = null;
+
     public CharacterMatrix(Composite parent, CharacterMatrixPart part) {
         super(parent, SWT.NONE);
         this.part = part;
@@ -250,6 +252,7 @@ public class CharacterMatrix extends Composite {
         /**
          * configuration
          */
+
         configureNatTable(treeView, configRegistry, topMostLayer);
 
         /**
@@ -325,18 +328,25 @@ public class CharacterMatrix extends Composite {
         categoricalFeatureToStateMap.put(feature, supportedStates);
     }
 
+
+
     private void createLayers(boolean treeView) {
+
         SortedList<Object> sortedList = new SortedList<>(descriptions, new MatrixRowComparator());
         // wrap the SortedList with the TreeList
         treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
         TreeList<Object> treeList = new TreeList(sortedList, treeFormat, TreeList.NODES_START_COLLAPSED);
+        // wrap the SortedList with the TreeList
+        treeFormat = new DescriptionTreeFormat(getDescriptiveDataSet());
+
         /**
          * data provider
          */
         SpecimenColumnPropertyAccessor columnPropertyAccessor = new SpecimenColumnPropertyAccessor(this);
         bodyDataProvider = treeView?new ListDataProvider<>(treeList, columnPropertyAccessor):new ListDataProvider<>(sortedList, columnPropertyAccessor);
 
-        configRegistry = new ConfigRegistry();
+        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
+        bodyDataLayer.registerCommandHandler(new CopyPasteUpdateDataCommandHandler(bodyDataLayer));
 
 
         /**
@@ -370,9 +380,8 @@ public class CharacterMatrix extends Composite {
          *
 
          */
-        DataLayer bodyDataLayer = new DataLayer(bodyDataProvider);
-        bodyDataLayer.registerCommandHandler(new CopyPasteUpdateDataCommandHandler(bodyDataLayer));
 
+        configRegistry = new ConfigRegistry();
         //register labels
         CharacterMatrixConfigLabelAccumulator labelAccumulator = new CharacterMatrixConfigLabelAccumulator(this);
         bodyDataLayer.setConfigLabelAccumulator(labelAccumulator);
@@ -403,7 +412,10 @@ public class CharacterMatrix extends Composite {
         freezeLayer = new FreezeLayer(selectionLayer);
         final CompositeFreezeLayer compositeFreezeLayer = new CompositeFreezeLayer(
                 freezeLayer, bodyLayer.getViewportLayer(), selectionLayer);
-        TreeLayer treeLayer = new TreeLayer(compositeFreezeLayer, treeRowModel);
+        TreeLayer treeLayer = null;
+        if (treeView){
+            treeLayer = new TreeLayer(compositeFreezeLayer, treeRowModel);
+        }
 
         topMostLayer = treeView?treeLayer:compositeFreezeLayer;
 
@@ -543,6 +555,11 @@ public class CharacterMatrix extends Composite {
         /**
          * CONFIGURATION
          */
+      //+++CONTEXT MENU+++
+        menuService.registerContextMenu(natTable, "eu.etaxonomy.taxeditor.editor.popupmenu.charactermatrix"); //$NON-NLS-1$
+        // get the menu registered by EMenuService
+        final Menu e4Menu = natTable.getMenu();
+
         natTable.setConfigRegistry(configRegistry);
 
         applyStyles();
@@ -563,7 +580,7 @@ public class CharacterMatrix extends Composite {
 
         // add the header menu configuration for adding the column header menu
         // with hide/show actions
-        natTable.addConfiguration(new CharacterMatrixHeaderMenuConfiguration(natTable));
+//        natTable.addConfiguration(new CharacterMatrixHeaderMenuConfiguration(natTable));
 
         // add custom configuration for data conversion and add column labels to viewport layer
         topMostLayer.addConfiguration(new CellEditorDataConversionConfiguration(this));
@@ -571,32 +588,41 @@ public class CharacterMatrix extends Composite {
         //copy&paste configuration
         natTable.addConfiguration(new CopyPasteEditBindings(bodyLayer.getSelectionLayer(), natTable.getInternalCellClipboard()));
 
-      //+++CONTEXT MENU+++
-        menuService.registerContextMenu(natTable, "eu.etaxonomy.taxeditor.editor.popupmenu.charactermatrix"); //$NON-NLS-1$
-        // get the menu registered by EMenuService
-        final Menu e4Menu = natTable.getMenu();
+
         // remove the menu reference from NatTable instance
         natTable.setMenu(null);
+
+
+//        natTable.addConfiguration(new CharacterMatrixHeaderMenuConfiguration(natTable));
+
+
+        natTable.configure();
+
+
         natTable.addConfiguration(
-                new AbstractUiBindingConfiguration() {
-            @Override
-            public void configureUiBindings(
-                    UiBindingRegistry uiBindingRegistry) {
-                // add e4 menu to NatTable
-                new PopupMenuBuilder(natTable, e4Menu)
+                    new AbstractUiBindingConfiguration() {
+                @Override
+                public void configureUiBindings(
+                        UiBindingRegistry uiBindingRegistry) {
+                    // add e4 menu to NatTable
+
+
+                    uiBindingRegistry.unregisterMouseDownBinding(mouseEventMatcher);
+                    new PopupMenuBuilder(natTable, e4Menu)
+                    .withHideColumnMenuItem()
+                    .withShowAllColumnsMenuItem()
                     .build();
 
-                // register the UI binding for header, corner and body region
-                uiBindingRegistry.registerMouseDownBinding(
-                        new MouseEventMatcher(
-                                SWT.NONE,
-                                null,
-                                MouseEventMatcher.RIGHT_BUTTON),
-                        new PopupMenuAction(e4Menu));
-            }
-        });
+                    // register the UI binding for header, corner and body region
+                    mouseEventMatcher = new MouseEventMatcher(
+                            SWT.NONE,
+                            null,
+                            MouseEventMatcher.RIGHT_BUTTON);
+                    uiBindingRegistry.registerMouseDownBinding(mouseEventMatcher,
+                            new PopupMenuAction(e4Menu));
+                }
+            });
 
-        natTable.configure();
     }
 
     void freezeSupplementalColumns(boolean freeze){
@@ -884,7 +910,7 @@ public class CharacterMatrix extends Composite {
 //            SpecimenRowWrapperDTO rowWrapper = new SpecimenRowWrapperDTO(wrapper.getUuidAndTitleCache(), wrapper.getType(), wrapper.getTaxonNode(), specimenMap.get(wrapper.getUuidAndTitleCache().getUuid()), null, null);
             descriptions.add(rowWrapper);
         }
-        loadingDone(false);
+
 
         setDirty();
     }
index ef33ff2b181d99e64485f40915947c1b1af10aba..f7f7794524db8fa90a40f189ae21aa57397bfdf9 100644 (file)
@@ -12,6 +12,7 @@ package eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix;
 import org.eclipse.nebula.widgets.nattable.NatTable;
 import org.eclipse.nebula.widgets.nattable.ui.menu.AbstractHeaderMenuConfiguration;
 import org.eclipse.nebula.widgets.nattable.ui.menu.PopupMenuBuilder;
+import org.eclipse.swt.widgets.Menu;
 
 /**
  * @author pplitzner
@@ -26,8 +27,14 @@ final class CharacterMatrixHeaderMenuConfiguration extends AbstractHeaderMenuCon
 
     @Override
     protected PopupMenuBuilder createColumnHeaderMenu(NatTable natTable) {
+        final Menu e4Menu = natTable.getMenu();
+
+
         return super.createColumnHeaderMenu(natTable)
                 .withHideColumnMenuItem()
                 .withShowAllColumnsMenuItem();
+
+
+
     }
 }
index a2ac3f3faf08b1e636f7ec421fc001d5a99271c6..973cf57a83990d296e871c20c8e16b901d28c778 100755 (executable)
@@ -24,7 +24,6 @@ import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.viewers.IStructuredSelection;
 import org.eclipse.jface.window.Window;
 
-import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
 import eu.etaxonomy.cdm.persistence.dto.SpecimenNodeWrapper;
 import eu.etaxonomy.cdm.persistence.dto.TaxonNodeDto;
 import eu.etaxonomy.taxeditor.editor.descriptiveDataSet.matrix.CharacterMatrix;
@@ -81,13 +80,12 @@ public class AddDescriptionHandler {
     @CanExecute
     public boolean canExecute(@Named(IServiceConstants.ACTIVE_PART)MPart activePart,
             MHandledMenuItem menuItem){
-        CharacterMatrixPart matrixPart = (CharacterMatrixPart) activePart.getObject();
-        IStructuredSelection selection = matrixPart.getSelection();
-        boolean canExecute = (selection.isEmpty() ||
-                !(selection.getFirstElement() instanceof SpecimenRowWrapperDTO) );
-
-        return canExecute;
-
-
+//        CharacterMatrixPart matrixPart = (CharacterMatrixPart) activePart.getObject();
+//        IStructuredSelection selection = matrixPart.getSelection();
+//        boolean canExecute = (selection.isEmpty() ||
+//                !(selection.getFirstElement() instanceof SpecimenRowWrapperDTO) );
+//
+//        return canExecute;
+        return true;
     }
 }