Community
Participate
Working Groups
Build Identifier: Default button reset not possible nor applicable Short discussion see: http://www.eclipse.org/forums/index.php?t=msg&th=206446&start=0&S=470c936971ffebeff518b1fb63a097bc Reproducible: Always Steps to Reproduce: 1. Extract attached zip and import application snippet projects for RCP and RAP 2. Run the snippet applications for RCP and RAP 3. Play around the option buttons setting default button. - You 'll see that in RAP the default button cannot be set to empty
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.