Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 356602

Summary: DefaultSelection Event doesn't get fired
Product: [Eclipse Project] Platform Reporter: Michael Seele <mseele>
Component: SWTAssignee: Arun Thondapu <arunkumar.thondapu>
Status: CLOSED DUPLICATE QA Contact:
Severity: normal    
Priority: P3 CC: arunkumar.thondapu, eclipse.felipe, lshanmug, remy.suen
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Snippet none

Description Michael Seele CLA 2011-09-02 10:27:55 EDT
Created attachment 202679 [details]
Snippet

We found a strange effect under Linux where the DefaultSelection Event in Text Controls isn't fired under certain circumstances.

We reproduced this effect under RHEL5, Fedora 15 (latest release; gtk: 2.24.4) and Ubuntu 11.04 (latest release; gtk: 2.24.4).

You can reproduce the bug when you run the attached snippet and do the following:

- Start the snippet
- Make shure the "focus button" button has the focus in shell 1 (default behaviour)
- Click on the "run" button in shell 2
- In shell 1 the "focus button" should now be disabled and the text control should have the focus and shell 1 is active
- Hit enter on shell 1
- Nothing appers on the console; Expected: a default selection event should be printed on the console

If the text control in shell 1 has the focus before pressing the "run" button in shell 2, everything works as expected (default selection event is printed to the console when hitting enter in shell 1).

We found the following steps seem to trigger the behaviour:
- We remove the text control in shell 1
- We disable the "focus button" button in shell 1
- We create a new text control in shell 1
- Now the text control don't get default selection events (the focus seems to hang something between the button and the text control)

This only appers when a second control is active while the text control is replaced and the button got disabled.
Comment 1 Michael Seele CLA 2011-09-02 10:36:41 EDT
> This only appers when a second control is active while the text control is
> replaced and the button got disabled.

Sorry, this should have said: 
This only appears when a second _shell_ is active while the text control is replaced and the button got disabled.
Comment 2 Felipe Heidrich CLA 2011-09-02 10:50:41 EDT
Arun, please investigate.
Comment 3 Arun Thondapu CLA 2011-09-08 05:36:50 EDT
I have been able to reproduce this behavior on Ubuntu 11.04.
The Text control does have the focus as you can type into it but I'm not sure why the default selection event doesn't seem to be getting fired.
Will try to investigate and then provide more updates.
Comment 4 Arun Thondapu CLA 2011-09-09 10:08:34 EDT
It looks like this problem is occurring because the button which is being disabled is the shell's default button and the default button seems to be getting the selection events fired via the Enter key.

Adding "shell1.setDefaultButton(null)" before disabling the default button in the "run" button's selection listener can be used as a workaround to avoid hitting this problem.
Comment 5 Arun Thondapu CLA 2011-09-14 09:12:48 EDT
The behavior described here is very similar to the one in this bug 297186.
Marking as duplicate.

*** This bug has been marked as a duplicate of bug 297186 ***