Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthew Davis2012-09-19 16:15:29 +0000
committerMatthew Davis2012-09-19 16:15:29 +0000
commitb9a72c71f3350b7dba86d516bfb5ea3fd2804870 (patch)
tree7165ac4431cfdcf7989a54d894fbf1cf1c663382
parenta7189022398b3515da45c386adba5d3674e2d3db (diff)
downloadorg.eclipse.stem-b9a72c71f3350b7dba86d516bfb5ea3fd2804870.tar.gz
org.eclipse.stem-b9a72c71f3350b7dba86d516bfb5ea3fd2804870.tar.xz
org.eclipse.stem-b9a72c71f3350b7dba86d516bfb5ea3fd2804870.zip
pulling up from trunk. Fixes SWTException in Graph Map view when STEM is shutdown with simulations running
git-svn-id: http://dev.eclipse.org/svnroot/technology/org.eclipse.stem/branches/STEM_1_4_0@3411 92a21009-5b66-0410-b83a-dc787c41c6e9
-rw-r--r--core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java46
1 files changed, 28 insertions, 18 deletions
diff --git a/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java b/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
index 96ad691be..7272fdd36 100644
--- a/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
+++ b/core/org.eclipse.stem.ui/src/org/eclipse/stem/ui/views/graphmap/GraphMapControl.java
@@ -67,6 +67,7 @@ import org.eclipse.stem.ui.adapters.color.ColorProviderAdapter;
import org.eclipse.stem.ui.adapters.color.ColorProviderAdapterFactory;
import org.eclipse.stem.ui.preferences.PreferenceConstants;
import org.eclipse.swt.SWT;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.layout.FillLayout;
import org.eclipse.swt.layout.FormAttachment;
@@ -75,6 +76,7 @@ import org.eclipse.swt.layout.FormLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
+import org.eclipse.ui.PlatformUI;
/**
* This class represents a visualization of the geographic attributes of a
@@ -253,30 +255,38 @@ public class GraphMapControl extends Composite implements ISimulationListener,
}
try {
- Display display = Display.getDefault();
-
- if (!display.isDisposed()) {
- display.asyncExec(new Runnable() {
-
- @Override
- public void run() {
- if (!canvas.isDisposed()) {
- canvas.render(polygonsToDraw, simulation);
- refreshJob = null;
-
- if (refreshPending) {
- refreshPending = false;
- refresh();
+ if (PlatformUI.isWorkbenchRunning()) {
+ Display display = Display.getDefault();
+
+ if (!display.isDisposed()) {
+ display.asyncExec(new Runnable() {
+
+ @Override
+ public void run() {
+ if (!canvas.isDisposed()) {
+ canvas.render(polygonsToDraw,
+ simulation);
+ refreshJob = null;
+
+ if (refreshPending) {
+ refreshPending = false;
+ refresh();
+ }
+ } else {
+ refreshJob = null;
}
- } else {
- refreshJob = null;
}
- }
- });
+ });
+ }
}
} catch (NullPointerException npe) {
// See 177966:
// We ignore the exception, there's nothing to do
+ } catch (SWTException se) {
+ // Sometimes this happens when shutting down STEM with
+ // simulations
+ // still running. Nothing we can do about it, so just
+ // ignore.
}
monitor.done();

Back to the top