From 597d8cae03bd64c4488a9b361e7929f0d592b707 Mon Sep 17 00:00:00 2001 From: Mathieu Baudier Date: Thu, 25 Oct 2012 09:37:53 +0000 Subject: [PATCH] IMprove centering of defualt login dialog in RCP git-svn-id: https://svn.argeo.org/commons/trunk@5644 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- .../org/argeo/security/ui/dialogs/DefaultLoginDialog.java | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) 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; -- 2.30.2