X-Git-Url: https://git.argeo.org/?a=blobdiff_plain;f=swt%2Forg.argeo.cms.swt%2Fsrc%2Forg%2Fargeo%2Fcms%2Fswt%2Fdialogs%2FLightweightDialog.java;h=3aec22a14eb791843c912c11057acb810081dacc;hb=2b036a42c6b5ace47fba14ca9d09ee6e37bf6c5f;hp=d74be6aa20c59c3ba4348c56f680f438a3514987;hpb=e4a5502f49e2a2c35d16bbc96efdffead1362a76;p=lgpl%2Fargeo-commons.git diff --git a/swt/org.argeo.cms.swt/src/org/argeo/cms/swt/dialogs/LightweightDialog.java b/swt/org.argeo.cms.swt/src/org/argeo/cms/swt/dialogs/LightweightDialog.java index d74be6aa2..3aec22a14 100644 --- a/swt/org.argeo.cms.swt/src/org/argeo/cms/swt/dialogs/LightweightDialog.java +++ b/swt/org.argeo.cms.swt/src/org/argeo/cms/swt/dialogs/LightweightDialog.java @@ -1,6 +1,7 @@ package org.argeo.cms.swt.dialogs; import org.argeo.api.cms.CmsLog; +import org.argeo.cms.ux.widgets.CmsDialog; import org.argeo.eclipse.ui.EclipseUiException; import org.eclipse.swt.SWT; import org.eclipse.swt.events.FocusEvent; @@ -20,11 +21,6 @@ import org.eclipse.swt.widgets.Shell; public class LightweightDialog { private final static CmsLog log = CmsLog.getLog(LightweightDialog.class); - // must be the same value as org.eclipse.jface.window.Window#OK - public final static int OK = 0; - // must be the same value as org.eclipse.jface.window.Window#CANCEL - public final static int CANCEL = 1; - private Shell parentShell; private Shell backgroundShell; private Shell foregoundShell; @@ -88,7 +84,7 @@ public class LightweightDialog { if (hasChildShells()) return; if (returnCode == null)// not yet closed - closeShell(CANCEL); + closeShell(CmsDialog.CANCEL); } @Override @@ -113,7 +109,7 @@ public class LightweightDialog { if (hasChildShells()) return; if (returnCode == null)// not yet closed - closeShell(CANCEL); + closeShell(CmsDialog.CANCEL); } }); backgroundShell.addDisposeListener((event) -> onClose()); @@ -122,7 +118,7 @@ public class LightweightDialog { block(); } if (returnCode == null) - returnCode = OK; + returnCode = CmsDialog.OK; return returnCode; } @@ -130,11 +126,11 @@ public class LightweightDialog { try { runEventLoop(foregoundShell); } catch (ThreadDeath t) { - returnCode = CANCEL; + returnCode = CmsDialog.CANCEL; if (log.isTraceEnabled()) log.error("Thread death, canceling dialog", t); } catch (Throwable t) { - returnCode = CANCEL; + returnCode = CmsDialog.CANCEL; log.error("Cannot open blocking lightweight dialog", t); } } @@ -162,13 +158,13 @@ public class LightweightDialog { private synchronized void notifyClose() { if (returnCode == null) - returnCode = CANCEL; + returnCode = CmsDialog.CANCEL; notifyAll(); } protected void closeShell(int returnCode) { this.returnCode = returnCode; - if (CANCEL == returnCode) + if (CmsDialog.CANCEL == returnCode) onCancel(); if (foregoundShell != null && !foregoundShell.isDisposed()) { foregoundShell.close();