commit 78e01af4e88af414d2066fc26dd595ca96165369
Author: Patrick Plitzner <p.plitzner@bgbm.org>
Date:   Thu Jul 26 13:37:47 2018 +0200

    ref #7589 Use progress monitor client manager to load character data

diff --git a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
index 9a1512b4c..ba1fb2e0f 100644
--- a/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
+++ b/eu.etaxonomy.taxeditor.editor/src/main/java/eu/etaxonomy/taxeditor/editor/descriptiveDataSet/matrix/CharacterMatrix.java
@@ -24,6 +24,7 @@ import javax.inject.Inject;
 import org.apache.commons.collections4.map.LinkedMap;
 import org.eclipse.core.runtime.ICoreRunnable;
 import org.eclipse.core.runtime.IProgressMonitor;
+import org.eclipse.core.runtime.SubMonitor;
 import org.eclipse.core.runtime.jobs.IJobChangeEvent;
 import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.core.runtime.jobs.JobChangeAdapter;
@@ -80,9 +81,7 @@ 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.application.CdmApplicationState;
 import eu.etaxonomy.cdm.api.service.IDescriptiveDataSetService;
-import eu.etaxonomy.cdm.api.service.IProgressMonitorService;
 import eu.etaxonomy.cdm.api.service.UpdateResult;
 import eu.etaxonomy.cdm.api.service.dto.RowWrapperDTO;
 import eu.etaxonomy.cdm.common.monitor.IRemotingProgressMonitor;
@@ -518,22 +517,34 @@ public class CharacterMatrix extends Composite {
 
     public void loadDescriptions(DescriptiveDataSet descriptiveDataSet) {
         UUID monitorUuid = CdmStore.getService(IDescriptiveDataSetService.class).monitGetRowWrapper(descriptiveDataSet);
-        IProgressMonitorService progressMonitorService = CdmApplicationState.getCurrentAppConfig().getProgressMonitorService();
 
         final Collection<RowWrapperDTO> wrappers = new ArrayList<>();
         String jobLabel = Messages.CharacterMatrix_LOAD_CHARACTER_DATA;
         Job job = Job.create(jobLabel, (ICoreRunnable) monitor -> {
-            monitor.beginTask(jobLabel, IProgressMonitor.UNKNOWN);
-            while(progressMonitorService.isMonitorThreadRunning(monitorUuid)){
-                if(monitor.isCanceled()){
-                    progressMonitorService.interrupt(monitorUuid);
-                }
+            SubMonitor subMonitor = SubMonitor.convert(monitor);
+            subMonitor.beginTask(jobLabel, IProgressMonitor.UNKNOWN);
+            IRemotingProgressMonitor remotingMonitor;
+            try {
+                 remotingMonitor = CdmStore.getProgressMonitorClientManager()
+                .pollMonitor(jobLabel,
+                        monitorUuid,
+                        50,
+                        null,
+                        (List)null,
+                        subMonitor);
+            } catch (InterruptedException e) {
+                MessagingUtils.informationDialog("Loading failed",
+                        "Loading of the character matrix failed. Please retry.");
+                return;
             }
-            IRemotingProgressMonitor remotingMonitor = progressMonitorService.getRemotingMonitor(monitorUuid);
             Object result = remotingMonitor.getResult();
             if(result instanceof Collection){
                 wrappers.addAll((Collection<RowWrapperDTO>) result);
             }
+            if(wrappers.isEmpty()){
+                MessagingUtils.informationDialog("No specimen descriptions found",
+                        "There are no specimens yet added to the matrix.");
+            }
             monitor.done();
         });
         job.addJobChangeListener(new JobChangeAdapter(){
@@ -552,7 +563,7 @@ public class CharacterMatrix extends Composite {
                 });
             }
         });
-        job.schedule(1000);
+        job.schedule();
     }
 
     private void loadingDone() {
