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

Bug 350016

Summary: Bad focus behavior by programmically give focus to a view breaks selection provider
Product: [RT] RAP Reporter: Arnaud MERGEY <a_mergey>
Component: WorkbenchAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3    
Version: 1.4   
Target Milestone: 1.5 M3   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
snippet to reproduce the issue none

Description Arnaud MERGEY CLA 2011-06-22 04:34:46 EDT
Tested with RAP 1.4 RC3

I noticed a strange behavior in my application, I have a job that programmatically open/activate a view when a job is finished.
Sometimes, the job is too short, so the progress dialog is not displayed. In this case it seems to break selection provider, as the focus remains on the previously activated view.

I have tested in RCP, it works as expected.

I can provide a snippet to reproduce the issue. (The snippet is single sourced, so it can be also checked against RCP)

-launch snippet.focus application
-click on "Long running" action on coolbar
- "View" takes focus.
- right-click on some item in "OtherView", you should see "My Action for current selection" menu.
-then click on "Short running" action on coolbar
-"View" takes focus.
- right-click on some item in "OtherView", the menu does not appear, as the view OtherView does not take focus. The only way to have it taking focus is to click on the header tab of the view.
Expected: we should have "My Action for current selection" menu as in RCP.

I noticed this issue only occurs if the progress dialog is not shown. If the dialog is shown, it works as expected, so as a workaround I put a Thread.sleep(1000) in the job, in order to have the dialog shown.
Comment 1 Arnaud MERGEY CLA 2011-06-22 04:38:30 EDT
Created attachment 198378 [details]
snippet to reproduce the issue
Comment 2 Ivan Furnadjiev CLA 2011-06-22 09:34:20 EDT
Reproducible with CVS HEAD too.
Comment 3 Ivan Furnadjiev CLA 2011-11-07 05:20:27 EST
I can't reproduce it anymore with current CVS HEAD. Probably this was fixed by the UICallBack rework (Bug 344989) or latest context menu fixes (bug 362243).