Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 391780 - Window Renderer fails to respond to it becoming the selected element
Summary: Window Renderer fails to respond to it becoming the selected element
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.2   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.3 M7   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard: candidate43
Keywords:
: 338861 (view as bug list)
Depends on:
Blocks:
 
Reported: 2012-10-12 09:08 EDT by Nobody - feel free to take it CLA
Modified: 2013-05-03 11:07 EDT (History)
4 users (show)

See Also:


Attachments
Proposed patch (1.59 KB, text/plain)
2012-10-18 06:34 EDT, Nobody - feel free to take it CLA
no flags Details
Proposed patch (1.97 KB, text/plain)
2012-10-29 11:37 EDT, Nobody - feel free to take it CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Nobody - feel free to take it CLA 2012-10-12 09:08:05 EDT
Details are here http://www.eclipse.org/forums/index.php/t/399305/

The idea is that bringToTop doesn't focus (bring to top) a window when there are multiple windows around.
Comment 1 Eric Moffatt CLA 2012-10-12 09:17:59 EDT
The fix here should be to have the WBWRenderer register a listener on SelectionChange and ensure the new 'top' window gets rendered / activated...
Comment 2 Nobody - feel free to take it CLA 2012-10-18 06:34:51 EDT
Created attachment 222512 [details]
Proposed patch

Eric can you have a look at this? I'm not sure on the setFocus or setActive part.
Comment 3 Brian de Alwis CLA 2012-10-18 10:29:13 EDT
Comment on attachment 222512 [details]
Proposed patch

Sopot: you need to remove the listener in contextDisposed().

If you look at org.eclipse.ui.internal.SwitchToWindowMenu, it does the following:

  Shell windowShell = window.getShell();
  if (windowShell.getMinimized()) {
    windowShell.setMinimized(false);
  }
  windowShell.setActive();
  windowShell.moveAbove(null);
Comment 4 Nobody - feel free to take it CLA 2012-10-18 10:34:50 EDT
Thanks Brian. I'll prepare another patch as soon as I can.
Comment 5 Brian de Alwis CLA 2012-10-25 15:35:18 EDT
*** Bug 338861 has been marked as a duplicate of this bug. ***
Comment 6 Nobody - feel free to take it CLA 2012-10-25 16:00:22 EDT
This is on top of my stack when I get back from EclipseCon, which is this weekend.
Comment 7 Nobody - feel free to take it CLA 2012-10-29 11:37:24 EDT
Created attachment 222937 [details]
Proposed patch

take 2
Comment 8 Nobody - feel free to take it CLA 2012-10-29 11:39:33 EDT
Setting a tentative 4.2.2. It's a relatively simple patch that takes no big time to test.
Comment 9 Eric Moffatt CLA 2012-10-29 13:42:06 EDT
Sopot, 'bringToTop' should *not* bring that window to the top. Not sure how I ended up commenting as I did...that's what you'd have to do if someone specifically made the M[Trimmed]Window the MApplication's selected element.

The reason falls out of the concept that 'bringToTop' doesn't change the active part (which is the difference between it and 'activate'). However bringing the window to the top would *require* changing the active part.

If someone wants this behavior why not just use 'activate' or, if it's not a part then use bringToTop and then explicitly set the MApplication's selectedElement.
Comment 10 Nobody - feel free to take it CLA 2012-10-29 18:58:06 EDT
Eric this patch doesn't modify the bringToTop behavior. 

In the status quo, if someone sets the MApp's selected element to be a certain window nothing happens. This patch changes it to set that window as an active window. 

Regarding bringToTop's behavior there is this line: 
window.getParent().setSelectedElement(window);
in the actual code (which I am not modifying) so the actual behavior *IS* that if a window is passed as an argument it will set the selected element of MApplication. So the fact is that doing bringToTop does set the selected element.

The bug is not about what bringToTop does but that the renderer doesn't respond to what it does with the model. Or at least this is how we discussed it on IRC and what I got out from it.
Comment 11 Eric Moffatt CLA 2012-11-06 09:52:56 EST
Thanks Sopot, yes adding the listener is the right thing to do since synch'ing the model to the screen paramount.

I'll have to change the current implementation of the ModelService though to remove the code that's setting the App's selected element in BTT.
Comment 12 Nobody - feel free to take it CLA 2012-11-06 10:00:39 EST
You also have to update the bTT's Javadoc because it explicitly states that if you specify a TL window as a param it will be selected as the Apps selected window...
Comment 13 Eric Moffatt CLA 2012-11-07 14:56:37 EST
Actually on re-reading the J'doc I'd be satisfied if it works as currently described...does it (with your patch) ?
Comment 14 Nobody - feel free to take it CLA 2012-11-07 16:15:44 EST
Yes. I don't touch bTT.
Comment 15 Paul Webster CLA 2013-01-11 14:02:59 EST
Defered to 4.3
Comment 16 Eric Moffatt CLA 2013-04-08 09:15:23 EDT
Apologies...fell off my radar...

http://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=bef4ce9767b8076dd7a5fa8f468ac93ecbaa8ce0

Applies Sopot's patch...thanks Sopot !!
Comment 17 Eric Moffatt CLA 2013-04-08 09:15:39 EDT
Marking fixed...
Comment 18 Eric Moffatt CLA 2013-05-02 13:57:55 EDT
Sopot, any chance you could test this and mark it verified if it's working ?
Comment 19 Nobody - feel free to take it CLA 2013-05-03 04:24:32 EDT
Verified in I20130502-0800
Comment 20 Eric Moffatt CLA 2013-05-03 11:07:17 EDT
Thanks Sopot !