ref #7439 Update marker change in supplemental view
authorPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 20 Jun 2018 10:35:14 +0000 (12:35 +0200)
committerPatrick Plitzner <p.plitzner@bgbm.org>
Wed, 20 Jun 2018 10:35:14 +0000 (12:35 +0200)
eu.etaxonomy.taxeditor.bulkeditor/src/main/java/eu/etaxonomy/taxeditor/bulkeditor/e4/handler/SetMarkerFlagHandlerE4.java
eu.etaxonomy.taxeditor.store/src/main/java/eu/etaxonomy/taxeditor/view/e4/supplementaldata/SupplementalDataPartE4.java

index 9fcd7eecd4f47072a326a28923d534478098fdeb..791860ef3f417e4939165256770243aae816717c 100644 (file)
@@ -22,12 +22,14 @@ import org.eclipse.e4.ui.model.application.ui.menu.MHandledMenuItem;
 import org.eclipse.e4.ui.services.IServiceConstants;
 import org.eclipse.jface.viewers.IStructuredSelection;
 
-import eu.etaxonomy.cdm.model.common.IAnnotatableEntity;
+import eu.etaxonomy.cdm.model.common.CdmBase;
 import eu.etaxonomy.cdm.model.common.MarkerType;
 import eu.etaxonomy.taxeditor.bulkeditor.BulkEditorUtil;
 import eu.etaxonomy.taxeditor.bulkeditor.e4.BulkEditorE4;
 import eu.etaxonomy.taxeditor.bulkeditor.e4.command.DynamicMarkerTypeEditingMenuE4;
 import eu.etaxonomy.taxeditor.bulkeditor.operation.SetMarkerFlagOperation;
+import eu.etaxonomy.taxeditor.event.EventUtility;
+import eu.etaxonomy.taxeditor.event.WorkbenchEventConstants;
 import eu.etaxonomy.taxeditor.model.AbstractUtility;
 import eu.etaxonomy.taxeditor.operation.AbstractPostOperation;
 
@@ -50,6 +52,13 @@ public class SetMarkerFlagHandlerE4 {
         IStructuredSelection selection = editor.getSelection();
         AbstractPostOperation operation = new SetMarkerFlagOperation("Set Marker", BulkEditorUtil.getUndoContext(), new HashSet<>(selection.toList()), markerType, markerState, editor);
         AbstractUtility.executeOperation(operation, sync);
+        Object[] array = selection.toArray();
+        for (Object object : array) {
+            editor.getEditorInput().addSaveCandidate((CdmBase) object);
+        }
+        editor.setDirty();
+        editor.refresh();
+        EventUtility.postEvent(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL, true);
     }
 
 
@@ -62,7 +71,7 @@ public class SetMarkerFlagHandlerE4 {
         Iterator iterator = selection.iterator();
         for(selection.iterator();iterator.hasNext();){
             Object object = iterator.next();
-            if(!(object instanceof IAnnotatableEntity)){
+            if(!(object instanceof CdmBase)){
                 canExecute = false;
                 break;
             }
index a44c45a660b822d9dcdd9114ba02f967968c0318..d89baa76caf945bb0df440540708175123fb80f4 100644 (file)
@@ -159,7 +159,6 @@ public class SupplementalDataPartE4 extends AbstractCdmEditorPartE4 {
     @Optional
     private void updateView(@UIEventTopic(WorkbenchEventConstants.REFRESH_SUPPLEMENTAL)boolean refresh){
         if(refresh){
-
             viewer.refresh();
         }
     }