From: Mathieu Baudier Date: Thu, 25 Oct 2012 09:37:53 +0000 (+0000) Subject: IMprove centering of defualt login dialog in RCP X-Git-Tag: argeo-commons-2.1.30~804 X-Git-Url: https://git.argeo.org/?a=commitdiff_plain;h=597d8cae03bd64c4488a9b361e7929f0d592b707;p=lgpl%2Fargeo-commons.git IMprove centering of defualt login dialog in RCP git-svn-id: https://svn.argeo.org/commons/trunk@5644 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/security/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/dialogs/DefaultLoginDialog.java b/security/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/dialogs/DefaultLoginDialog.java index c07e8a9df..dc7c09a99 100644 --- a/security/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/dialogs/DefaultLoginDialog.java +++ b/security/plugins/org.argeo.security.ui/src/main/java/org/argeo/security/ui/dialogs/DefaultLoginDialog.java @@ -54,8 +54,13 @@ public class DefaultLoginDialog extends AbstractLoginDialog { protected Control createContents(Composite parent) { Control control = super.createContents(parent); parent.pack(); + // Move the dialog to the center of the top level shell. - Rectangle shellBounds = Display.getCurrent().getBounds(); + Rectangle shellBounds; + if (Display.getCurrent().getActiveShell() != null) // RCP + shellBounds = Display.getCurrent().getActiveShell().getBounds(); + else + shellBounds = Display.getCurrent().getBounds();// RAP Point dialogSize = parent.getSize(); int x = shellBounds.x + (shellBounds.width - dialogSize.x) / 2; int y = shellBounds.y + (shellBounds.height - dialogSize.y) / 2;