summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSteve Northover <steve>2005-07-07 19:13:34 +0000
committerSteve Northover <steve>2005-07-07 19:13:34 +0000
commit2ea25c96286236f354aced27faa694ecd64ebf8b (patch)
treed1aab8d77187a41f80ba74cbd74c72c7159f5c2f
parentb351c4c38db9a8cd7f2e9c9976c3c0386fe57c0b (diff)
downloadeclipse.platform.swt-2ea25c96286236f354aced27faa694ecd64ebf8b.tar.gz
eclipse.platform.swt-2ea25c96286236f354aced27faa694ecd64ebf8b.tar.xz
eclipse.platform.swt-2ea25c96286236f354aced27faa694ecd64ebf8b.zip
check to make sure default button is in widget tree
-rwxr-xr-xbundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java6
1 files changed, 5 insertions, 1 deletions
diff --git a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
index 46067b9bb1..7f5ae7e3a0 100755
--- a/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
+++ b/bundles/org.eclipse.swt/Eclipse SWT/win32/org/eclipse/swt/widgets/Decorations.java
@@ -873,6 +873,7 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
*
* @exception IllegalArgumentException <ul>
* <li>ERROR_INVALID_ARGUMENT - if the button has been disposed</li>
+ * <li>ERROR_INVALID_PARENT - if the control is not in the same widget tree</li>
* </ul>
* @exception SWTException <ul>
* <li>ERROR_WIDGET_DISPOSED - if the receiver has been disposed</li>
@@ -881,6 +882,10 @@ void setBounds (int x, int y, int width, int height, int flags, boolean defer) {
*/
public void setDefaultButton (Button button) {
checkWidget ();
+ if (button != null) {
+ if (button.isDisposed ()) error (SWT.ERROR_INVALID_ARGUMENT);
+ if (button.menuShell () != this) error(SWT.ERROR_INVALID_PARENT);
+ }
setDefaultButton (button, true);
}
@@ -891,7 +896,6 @@ void setDefaultButton (Button button, boolean save) {
return;
}
} else {
- if (button.isDisposed()) error(SWT.ERROR_INVALID_ARGUMENT);
if ((button.style & SWT.PUSH) == 0) return;
if (button == defaultButton) return;
}