ref #7589 Remove UpdateResult handling from CharacterMatrix
[taxeditor.git] / eu.etaxonomy.taxeditor.editor / src / main / java / eu / etaxonomy / taxeditor / editor / descriptiveDataSet / matrix / CharacterMatrix.java
index d5faf4756c6cf2c07b9c041a675dcf49943f52c4..9f4e4a503018c8b2ca2812d5f227ed42ffaa6016 100644 (file)
@@ -43,6 +43,7 @@ import org.eclipse.nebula.widgets.nattable.coordinate.Range;
 import org.eclipse.nebula.widgets.nattable.data.IDataProvider;
 import org.eclipse.nebula.widgets.nattable.data.ListDataProvider;
 import org.eclipse.nebula.widgets.nattable.export.command.ExportCommandHandler;
+import org.eclipse.nebula.widgets.nattable.extension.e4.selection.E4SelectionListener;
 import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsEventLayer;
 import org.eclipse.nebula.widgets.nattable.extension.glazedlists.GlazedListsSortModel;
 import org.eclipse.nebula.widgets.nattable.extension.glazedlists.tree.GlazedListTreeData;
@@ -91,11 +92,11 @@ import ca.odell.glazedlists.BasicEventList;
 import ca.odell.glazedlists.EventList;
 import ca.odell.glazedlists.SortedList;
 import ca.odell.glazedlists.TreeList;
-import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
-import eu.etaxonomy.cdm.api.service.UpdateResult;
+import eu.etaxonomy.cdm.api.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
 import eu.etaxonomy.cdm.api.service.dto.SpecimenRowWrapperDTO;
 import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
+import eu.etaxonomy.cdm.model.description.Character;
 import eu.etaxonomy.cdm.model.description.DescriptionBase;
 import eu.etaxonomy.cdm.model.description.DescriptiveDataSet;
 import eu.etaxonomy.cdm.model.description.Feature;
@@ -129,9 +130,13 @@ public class CharacterMatrix extends Composite {
 
     static final String LABEL_TAXON_ROW = "TAXON_ROW"; //$NON-NLS-1$
     static final String LABEL_TAXON_AGGREGATED_DESCRIPTION = "TAXON_AGGREGATED_DESCRIPTION"; //$NON-NLS-1$
+    static final String LABEL_TAXON_AGGREGATED_DESCRIPTION_ICON = "TAXON_AGGREGATED_DESCRIPTION_ICON"; //$NON-NLS-1$
     static final String LABEL_TAXON_DEFAULT_DESCRIPTION = "TAXON_DEFAULT_DESCRIPTION"; //$NON-NLS-1$
+    static final String LABEL_TAXON_DEFAULT_DESCRIPTION_ICON = "TAXON_DEFAULT_DESCRIPTION_ICON"; //$NON-NLS-1$
     static final String LABEL_TAXON_LITERATURE_DESCRIPTION = "TAXON_LITERATURE_DESCRIPTION"; //$NON-NLS-1$
+    static final String LABEL_TAXON_LITERATURE_DESCRIPTION_ICON = "TAXON_LITERATURE_DESCRIPTION_ICON"; //$NON-NLS-1$
     static final String LABEL_TAXON_DESCRIPTION = "LABEL_TAXON_DESCRIPTION"; //$NON-NLS-1$
+    static final String LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA = "LABEL_DESCRIPTION_HAS_SUPPLEMENTAL_DATA"; //$NON-NLS-1$
 
     @Inject
     private UISynchronize sync;
@@ -266,7 +271,10 @@ public class CharacterMatrix extends Composite {
         List<Feature> features = new ArrayList<>();
         node.getChildNodes().forEach(childNode->
                 {
-                    features.add(childNode.getFeature());
+                    Feature feature = childNode.getFeature();
+                    if(feature.isInstanceOf(Character.class)){
+                        features.add(childNode.getFeature());
+                    }
                     features.addAll(initFeatureList(childNode));
                 });
         return features;
@@ -446,8 +454,11 @@ public class CharacterMatrix extends Composite {
         // exporting work
         topMostLayer.registerCommandHandler(new ExportCommandHandler(topMostLayer));
 
-        //propagate single cell selection
-        natTable.addLayerListener(new CellSelectionListener(part));
+        //selection listener
+        E4SelectionListener selectionListener = new CellSelectionListener(part.getSelectionService(),
+                bodyLayer.getSelectionLayer(), bodyDataProvider, part);
+        bodyLayer.getSelectionLayer().addLayerListener(selectionListener);
+        selectionListener.setFullySelectedRowsOnly(false);
 
         //register handler for view configuration menu
         natTable.registerCommandHandler(toolbar.getDisplayPersistenceDialogCommandHandler());
@@ -558,7 +569,7 @@ public class CharacterMatrix extends Composite {
     }
 
     public void loadDescriptions(DescriptiveDataSet descriptiveDataSet) {
-        UUID monitorUuid = CdmStore.getService(IDescriptiveDataSetService.class).monitGetRowWrapper(descriptiveDataSet);
+        UUID monitorUuid =  CdmApplicationState.getLongRunningTasksService().monitGetRowWrapper(descriptiveDataSet);
 
         final Collection<RowWrapperDTO> wrappers = new ArrayList<>();
         String jobLabel = Messages.CharacterMatrix_LOAD_CHARACTER_DATA;
@@ -696,10 +707,6 @@ public class CharacterMatrix extends Composite {
         return features;
     }
 
-    public void addUpdateResult(UpdateResult result){
-        part.addUpdateResult(result);
-    }
-
     public Map<Feature, CategoricalDataHistogram> getFeatureToHistogramMap() {
         return featureToHistogramMap;
     }