Fix issue with username case in LDAP
[lgpl/argeo-commons.git] / eclipse / runtime / org.argeo.eclipse.ui / src / main / java / org / argeo / eclipse / ui / Error.java
index 96724adff9d3285165cb967001267ea19be0ff69..04971d15545da6dd1393677df94da8597a3a2fc3 100644 (file)
@@ -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();
                }