From: Tuukka Lehtonen Date: Fri, 19 Oct 2018 12:00:46 +0000 (+0300) Subject: Use DatabaseJob instead of Job to prevent UI from getting stuck X-Git-Url: https://gerrit.simantics.org/r/gitweb?a=commitdiff_plain;h=b654d9f368d601565303bcf646fc4fbdfbc37090;p=simantics%2Fdistrict.git Use DatabaseJob instead of Job to prevent UI from getting stuck 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 (cherry picked from commit 15c720d419c1139942790dc12acb6936e75b1568) --- diff --git a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/DistrictNetworkBreakdownPanel.java b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/DistrictNetworkBreakdownPanel.java index 39770b6b..b3e6d6bb 100644 --- a/org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/DistrictNetworkBreakdownPanel.java +++ b/org.simantics.district.network.ui/src/org/simantics/district/network/ui/breakdown/DistrictNetworkBreakdownPanel.java @@ -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;