]> gerrit.simantics Code Review - simantics/district.git/commitdiff
Use DatabaseJob instead of Job to prevent UI from getting stuck 37/2337/1
authorTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 19 Oct 2018 12:00:46 +0000 (15:00 +0300)
committerTuukka Lehtonen <tuukka.lehtonen@semantum.fi>
Fri, 19 Oct 2018 12:00:46 +0000 (15:00 +0300)
The breakdown calculation can take a long time, thus it is better to
reverse the database for that time so that the rest of the UI doesn't
start synchronously waiting for DB access.

gitlab #11

Change-Id: If4556559009ea8109b95cf6c12d7bae2243d59f3

org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/DistrictNetworkBreakdownPanel.java

index 39770b6b8c9fb79e9115f7be55ccb502b7ed7398..b3e6d6bbecad2d55ded30fa868829ec51fb959ae 100644 (file)
@@ -9,7 +9,6 @@ import org.eclipse.core.runtime.IProgressMonitor;
 import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Status;
 import org.eclipse.core.runtime.SubMonitor;
-import org.eclipse.core.runtime.jobs.Job;
 import org.eclipse.jface.action.Action;
 import org.eclipse.jface.action.IMenuListener;
 import org.eclipse.jface.action.IMenuManager;
@@ -42,6 +41,7 @@ import org.eclipse.swt.graphics.Image;
 import org.eclipse.swt.widgets.Composite;
 import org.eclipse.swt.widgets.Menu;
 import org.eclipse.swt.widgets.TreeColumn;
+import org.simantics.DatabaseJob;
 import org.simantics.NameLabelMode;
 import org.simantics.NameLabelUtil;
 import org.simantics.ObjectIdentitySchedulingRule;
@@ -415,7 +415,7 @@ public class DistrictNetworkBreakdownPanel extends Composite {
 
     }
 
-    private class CalculateSubgraphs extends Job {
+    private class CalculateSubgraphs extends DatabaseJob {
 
         private NetworkDiagram diagram;