Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLars Vogel2019-02-08 13:32:18 +0000
committerLars Vogel2019-02-12 18:06:30 +0000
commitd53766b589f0bcb0693c31c4a1da442f9206340e (patch)
tree58d07a85855aff70abd6b4ccf8946bbdd72bd825
parent76d36bfcb28d92c9dfa7ecf16d298d7e6c6bd2b4 (diff)
downloadeclipse.platform.ui-d53766b589f0bcb0693c31c4a1da442f9206340e.tar.gz
eclipse.platform.ui-d53766b589f0bcb0693c31c4a1da442f9206340e.tar.xz
eclipse.platform.ui-d53766b589f0bcb0693c31c4a1da442f9206340e.zip
Bug 544286 - Evaluate if Dialogs#initializeBounds can use requestLayout
Tested with a runtime Eclipse for several dialogs and found no layout issue under Linux. Change-Id: If40940ee681f8b22d669891b33b9e954acaf06c0 Signed-off-by: Lars Vogel <Lars.Vogel@vogella.com>
-rw-r--r--bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java5
-rw-r--r--tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java12
2 files changed, 10 insertions, 7 deletions
diff --git a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
index 1a7d7efdf19..37f95c4341e 100644
--- a/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
+++ b/bundles/org.eclipse.jface/src/org/eclipse/jface/dialogs/Dialog.java
@@ -713,10 +713,9 @@ public abstract class Dialog extends Window {
if (shell.getDisplay().getDismissalAlignment() == SWT.RIGHT) {
// make the default button the right-most button
Button defaultButton = shell.getDefaultButton();
- if (defaultButton != null
- && isContained(buttonBar, defaultButton)) {
+ if (defaultButton != null && isContained(buttonBar, defaultButton)) {
defaultButton.moveBelow(null);
- defaultButton.getParent().layout();
+ defaultButton.getParent().requestLayout();
}
}
}
diff --git a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
index 0bc0070daec..712e126a160 100644
--- a/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
+++ b/tests/org.eclipse.ui.tests/Eclipse JFace Tests/org/eclipse/jface/tests/dialogs/DialogTest.java
@@ -13,16 +13,17 @@
******************************************************************************/
package org.eclipse.jface.tests.dialogs;
-import junit.framework.TestCase;
-
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.widgets.Button;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
+import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
+import junit.framework.TestCase;
+
public class DialogTest extends TestCase {
/**
@@ -58,11 +59,14 @@ public class DialogTest extends TestCase {
forceLayoutDialog.setBlockOnOpen(false);
// open the dialog so the widgets will be realized
forceLayoutDialog.open();
+ int waitEvents = 0;
+ while (Display.getDefault().readAndDispatch() && waitEvents++ < 500) {
+ // spin the event loop
+ }
// retrieve the 'OK' and 'Cancel' buttons
Button okBtn = forceLayoutDialog.getButton(IDialogConstants.OK_ID);
- Button cancelBtn = forceLayoutDialog
- .getButton(IDialogConstants.CANCEL_ID);
+ Button cancelBtn = forceLayoutDialog.getButton(IDialogConstants.CANCEL_ID);
// retrieve the X coordinates of the two buttons
int okX = okBtn.getBounds().x;

Back to the top