Improve CMS dialogs and localisation.
[lgpl/argeo-commons.git] / org.argeo.eclipse.ui / src / org / argeo / eclipse / ui / dialogs / LightweightDialog.java
index 5649a1571cdefa0fa3f62f88f8abdcb356f47080..d00365bf2c7e8ad1aa6547ffae2a326a6d8ecfd8 100644 (file)
@@ -1,18 +1,3 @@
-/*
- * Copyright (C) 2007-2012 Argeo GmbH
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- *         http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
 package org.argeo.eclipse.ui.dialogs;
 
 import org.apache.commons.logging.Log;
@@ -33,6 +18,7 @@ import org.eclipse.swt.widgets.Display;
 import org.eclipse.swt.widgets.Shell;
 
 /** Generic lightweight dialog, not based on JFace. */
+@Deprecated
 public class LightweightDialog {
        private final static Log log = LogFactory.getLog(LightweightDialog.class);
 
@@ -131,22 +117,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;
@@ -229,6 +219,8 @@ public class LightweightDialog {
                                if (!display.readAndDispatch()) {
                                        display.sleep();
                                }
+                       } catch (UnsupportedOperationException e) {
+                               throw e;
                        } catch (Throwable e) {
                                handleException(e);
                        }