Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 320746 - Hide toolbar hides toolbar from a wrong window
Summary: Hide toolbar hides toolbar from a wrong window
Status: RESOLVED WORKSFORME
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 1.0   Edit
Hardware: Macintosh Mac OS X
: P3 normal (vote)
Target Milestone: ---   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
: 346318 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-07-23 11:56 EDT by Oleg Besedin CLA
Modified: 2018-10-08 11:29 EDT (History)
3 users (show)

See Also:


Attachments
Patch to enable toggle-toolbar for non-focussed windows for E3.x (4.33 KB, patch)
2010-09-09 14:55 EDT, Brian de Alwis CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Oleg Besedin CLA 2010-07-23 11:56:16 EDT
The "hide toolbar" button can be tricked to change toolbar visibility in a wrong window:

 - Window -> new Window
 - switch to the 1st window by clicking on the pill itself, click again on the
pill to hide toolbar
Comment 1 Boris Bokowski CLA 2010-07-25 01:18:30 EDT
Happens in 3.6, too.
Comment 2 Brian de Alwis CLA 2010-09-09 10:54:27 EDT
This happens because the code uses the MApplication's selectedElement, which is the window with focus.  This doesn't work if you select the pill on a window without focus.
Comment 3 Brian de Alwis CLA 2010-09-09 11:20:03 EDT
Oops, too quick on the draw.  We do find the corresponding window, but we just invoke the org.eclipse.ui.ToggleCoolbarAction command and don't pass the window as a parameter.  I'm guessing the command is serviced by an E3.x handler.
Comment 4 Brian de Alwis CLA 2010-09-09 14:55:46 EDT
Created attachment 178546 [details]
Patch to enable toggle-toolbar for non-focussed windows for E3.x

I have a fix for the E3.x case.  Unfortunately I have no idea how to fix this for e4.x.

The handler for org.eclipse.ui.ToggleCoolbarAction is org.eclipse.ui.internal.handlers.ToggleCoolbarHandler, which uses HandlerUtil.getActiveWorkbenchWindowChecked() to determine the window to toggle.  This method pulls the active window from the command's evaluation context.

I've patched E3.x's CocoaUIEnhancer to provide a suitably-configured evaluation context, and I can now toggle the toolbar for non-focussed windows.

Unfortunately I have no idea how to do this for e4.x as there doesn't seem to be an equivalent to evaluation contexts.  If the command took the window as a parameter...
Comment 5 Brian de Alwis CLA 2011-05-18 15:49:18 EDT
*** Bug 346318 has been marked as a duplicate of this bug. ***
Comment 6 Eclipse Genie CLA 2018-10-07 14:47:16 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.