X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=eclipse%2Fruntime%2Forg.argeo.eclipse.ui%2Fsrc%2Fmain%2Fjava%2Forg%2Fargeo%2Feclipse%2Fui%2FError.java;h=04971d15545da6dd1393677df94da8597a3a2fc3;hb=118878eb12c8e142da7648cae3880754b34798b2;hp=96724adff9d3285165cb967001267ea19be0ff69;hpb=30808844bdd83ed7a7398af4ef4c470975a3067a;p=lgpl%2Fargeo-commons.git diff --git a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/Error.java b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/Error.java index 96724adff..04971d155 100644 --- a/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/Error.java +++ b/eclipse/runtime/org.argeo.eclipse.ui/src/main/java/org/argeo/eclipse/ui/Error.java @@ -26,6 +26,11 @@ public class Error extends TitleAreaDialog { private final Throwable exception; public static void show(String message, Throwable e) { + // rethrow ThreaDeath in order to make sure that RAP will properly clean + // up the UI thread + if (e instanceof ThreadDeath) + throw (ThreadDeath) e; + new Error(getDisplay().getActiveShell(), message, e).open(); } @@ -36,7 +41,11 @@ public class Error extends TitleAreaDialog { /** Tries to find a display */ private static Display getDisplay() { try { - return PlatformUI.getWorkbench().getDisplay(); + Display display = PlatformUI.getWorkbench().getDisplay(); + if (display != null) + return display; + else + return Display.getDefault(); } catch (Exception e) { return Display.getCurrent(); }