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

Bug 327642

Summary: [Menu] overrides the focus/active child when disappear
Product: [RT] RAP Reporter: Markus Krüger <webmaster>
Component: RWTAssignee: Project Inbox <rap-inbox>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P2 CC: dev, v.althaus
Version: 1.3   
Target Milestone: 2.2 M3   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
Workbench Demo patch to reproduce the problem none

Description Markus Krüger CLA 2010-10-13 06:29:44 EDT
Reproduceable in the demo.
If you do a right click on the Tree Item of a view, then it should activate the view.
This DOES happen in most cases, but when you do a right click on Root of View I to open a menu and you do a right click on View III on Root (so that the menu of View I is still visible), then the View II does not get the focus and so it is not the active part. This leads to the issue that menu entries working with activePartId do not work.
Comment 1 Ivan Furnadjiev CLA 2010-10-15 05:02:16 EDT
Created attachment 180933 [details]
Workbench Demo patch to reproduce the problem
Comment 2 Markus Krüger CLA 2010-10-15 07:45:53 EDT
I did not need to change the workbench demo to reproduce the behavior.
Is there a reasen for the patch?
Comment 3 Ivan Furnadjiev CLA 2010-10-15 07:49:49 EDT
Markus, the patch add a menu to the Tree in DemoTreeViewPart. How to reproduce it without a menu on a Tree?
Comment 4 Markus Krüger CLA 2010-10-15 07:53:35 EDT
You are so right, Ivan.
I had the bug earlier and when I posted it I could not see any changes on my project anymore as I already reverted it, I guess :-(

I'm sorry for the trouble.
Comment 5 Ivan Furnadjiev CLA 2010-10-18 06:34:12 EDT
I've just tested a little bit. The problem exists with 1.3 (1.3.1) release too. In case of opened menu we have wrong values in the  request parameters org.eclipse.swt.events.controlActivated and activeControl.
Comment 6 Ivan Furnadjiev CLA 2010-10-18 08:04:35 EDT
The situation is the following:
1. When you open a context menu the current active and focused child are save in the variables _lastActive and _lastFocus (see Menu.js#_beforeAppear -> _makeActive).
2. When you click (left or right) somewhere in the application (with already opened context menu), first the new focus/active child is set on mouse down and than the menu is about to disappear. But in Menu.js#_beforeDisappear the _makeInactive is called, witch restore the focus/active child to the saved one. Thus, the  focus/active child set by the mouse are lost (overriten by the saved one).
As we have plans to rework the mouse event handling (EventHandler.js), this bug should be fixed with this rework.
Comment 7 Ivan Furnadjiev CLA 2013-11-04 09:37:10 EST
*** Bug 419839 has been marked as a duplicate of this bug. ***
Comment 8 Ivan Furnadjiev CLA 2013-11-08 04:29:55 EST
Fixed in master with commit 34c83d2967652738a0617744742fb9cc2451f275.
Comment 9 Ivan Furnadjiev CLA 2013-11-27 05:32:36 EST
*** Bug 422578 has been marked as a duplicate of this bug. ***