| Summary: | RWT Dialog setDefaultButton is not recognized properly | ||||||||
|---|---|---|---|---|---|---|---|---|---|
| Product: | [RT] RAP | Reporter: | Thomas Jodes <tjodes> | ||||||
| Component: | RWT | Assignee: | Project Inbox <rap-inbox> | ||||||
| Status: | RESOLVED FIXED | QA Contact: | |||||||
| Severity: | normal | ||||||||
| Priority: | P3 | CC: | ruediger.herrmann | ||||||
| Version: | unspecified | ||||||||
| Target Milestone: | 1.5 M2 | ||||||||
| Hardware: | PC | ||||||||
| OS: | Windows XP | ||||||||
| Whiteboard: | |||||||||
| Attachments: |
|
||||||||
|
Description
Thomas Jodes
Created attachment 191738 [details]
RCP and RAP projects for reproducibility
RCP and RAP projects for reproducibility
I do not know if or how this issue is still related with the assumed-to-be fixed swt bug report https://bugs.eclipse.org/bugs/show_bug.cgi?id=297477 Thomas, just updated the method Shell#setDefaultButton to match the SWT Decorations#setDefaultButton. This change integrates the fix for bug 297477 in RAP. The main difference between RAP and RCP is that in RCP when a button receives a focus it is set as temporary default button (without saving). When a button looses a focus, setDefaultButton( null, false) is called. But in both RAP/RCP the test case bellow works - need to call setDefaultButton(null) twice to remove the default button: public void testResetDefaultButton() { Display display = new Display(); Shell shell = new Shell( display, SWT.NONE ); Button defaultButton = new Button( shell, SWT.PUSH ); shell.setDefaultButton( defaultButton ); shell.setDefaultButton( null ); assertSame( defaultButton, shell.getDefaultButton() ); shell.setDefaultButton( null ); assertNull( shell.getDefaultButton() ); } Test case that pass in SWT but not in RAP:
public void testSetDefaultButtonOnFocus() {
Display display = new Display();
Shell shell = new Shell( display, SWT.NONE );
shell.open();
assertNull( shell.getDefaultButton() );
Button button = new Button( shell, SWT.PUSH );
Combo combo = new Combo( shell, SWT.NONE );
button.setFocus();
assertSame( button, shell.getDefaultButton() );
combo.setFocus();
assertNull( shell.getDefaultButton() );
display.dispose();
}
Created attachment 192469 [details]
Proposed fix
With this patch I can't see more differences for defaultButton behavior in RAP and RCP. JUnit tests included, passed in RAP and RCP. Thomas, could you confirm this?
Hi Ivan, sorry for the late reply - however, I can confirm this, just tested against RAP 1.4RC1. Well, when will the changes be included? As RAP stands at RC1 now... Thomas, as we are at RC3 now (built RC2 today), it's too late to include this fix in 1.4 release. Probably will be included in 1.5M1. Applied patch to CVS HEAD with some refactorings. |