Stop trying if UI loop is not supported.
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / dialogs / LightweightDialog.java
index c34979e38f1bac0be065a3777bd08e271477e2b3..606030e38079452eee9ae3239cff55c6a453d633 100644 (file)
@@ -116,22 +116,26 @@ public class LightweightDialog {
                });
 
                if (block) {
-                       try {
-                               runEventLoop(foregoundShell);
-                       } catch (ThreadDeath t) {
-                               returnCode = CANCEL;
-                               if (log.isTraceEnabled())
-                                       log.error("Thread death, canceling dialog", t);
-                       } catch (Throwable t) {
-                               returnCode = CANCEL;
-                               log.error("Cannot open blocking lightweight dialog", t);
-                       }
+                       block();
                }
                if (returnCode == null)
                        returnCode = OK;
                return returnCode;
        }
 
+       public void block() {
+               try {
+                       runEventLoop(foregoundShell);
+               } catch (ThreadDeath t) {
+                       returnCode = CANCEL;
+                       if (log.isTraceEnabled())
+                               log.error("Thread death, canceling dialog", t);
+               } catch (Throwable t) {
+                       returnCode = CANCEL;
+                       log.error("Cannot open blocking lightweight dialog", t);
+               }
+       }
+
        private boolean hasChildShells() {
                if (foregoundShell == null)
                        return false;
@@ -214,6 +218,8 @@ public class LightweightDialog {
                                if (!display.readAndDispatch()) {
                                        display.sleep();
                                }
+                       } catch (UnsupportedOperationException e) {
+                               throw e;
                        } catch (Throwable e) {
                                handleException(e);
                        }