Bug 323706 - [DetachedView] View contributions to the main menu bar cannot be clicked if said view is detached
Summary: [DetachedView] View contributions to the main menu bar cannot be clicked if s...
Status: REOPENED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 normal with 1 vote (vote)
Target Milestone: ---   Edit
Assignee: Platform UI Triaged CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 100909 324074 326987 346279 388066 573530 (view as bug list)
Depends on:
Blocks:
 
Reported: 2010-08-26 09:19 EDT by Remy Suen CLA
Modified: 2024-01-17 10:10 EST (History)
16 users (show)

See Also:


Attachments
Screenshot depicting the problem in question. (16.24 KB, image/png)
2010-08-26 09:19 EDT, Remy Suen CLA
no flags Details
SWT Testbed (3.78 KB, text/x-java)
2010-11-11 15:06 EST, Eric Moffatt CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Remy Suen CLA 2010-08-26 09:19:19 EDT
Created attachment 177528 [details]
Screenshot depicting the problem in question.

M20100825-0800

1. Close all editors if any are open.
2. Detach the 'Package Explorer' view.
3. Activate the 'Problems' view in the original workbench window.
4. Activate the detached 'Package Explorer' view.
5. You should see a 'Source' menu in the workbench window.
6. Try to click the 'Source' menu.
7. You will end up getting the 'Navigate' menu.
Comment 1 Eric Moffatt CLA 2010-08-31 15:55:59 EDT
This is a regression! It works in 3.4...

The issue here seems to be the activation handling which activates some part *within* the main window when the shell activates...this ends up resulting in the menu being re-evaluated...

Not sure to whom it should go (DW's, Commands, Workbench?) but I'll tag it for 3.7 so it won't get lost...
Comment 2 Eric Moffatt CLA 2010-09-01 10:28:41 EDT
I wasn't following the repro instructions exactly (no editors open!), this problem exists in 3.4 (it's not a regression...).
Comment 3 Markus Keller CLA 2010-09-01 10:31:42 EDT
Yeah, I also don't see a difference between 3.4.2 and HEAD. It works in a few limited scenarios, but I guess that's more by chance (e.g. when the active view in the main window doesn't have a selection -- e.g. the empty Type Hierarchy view).

The underlying problem is that the focus and goes to the main window. This changes the current selection and therefore makes all selection-dependent actions unusable (menus, main toolbar buttons).
Comment 4 Markus Keller CLA 2010-09-01 10:32:07 EDT
*** Bug 324074 has been marked as a duplicate of this bug. ***
Comment 5 Eric Moffatt CLA 2010-09-01 11:14:39 EDT
I'll send this to 'Workbench' since its an activation issue...
Comment 6 Dani Megert CLA 2010-09-01 12:16:06 EDT
Fixing that by allowing the actions in the main window to go to the detached view would be unexpected because at the end of the action you have the main window with its recent active part in focus but the last action executed on the selection from the detached view.

A simpler approach could be to disable the actions in the main window if the detached view has focus. Important is to not hide/show menus and toolbar items. With such an approach bug 324074 is not a dup and becomes invalid again.
Comment 7 Dani Megert CLA 2010-10-05 05:38:42 EDT
*** Bug 326987 has been marked as a duplicate of this bug. ***
Comment 8 Eric Moffatt CLA 2010-11-09 14:39:05 EST
The actual issue here is that we change the active part when the main shell gets activated...

This is the result of an SWT.Activate listener in the PartPane which calls 'requestActivation', a specific invitation for the main WB to activate a part in itself.

Perhaps the fix should be to have requestActivation honor DW's ??
Comment 9 Eric Moffatt CLA 2010-11-09 16:11:53 EST
Worse than I thought...this is a result of the Shell's restoreFocus method granting focus (and activating) the last widget with focus in the shell owning the menu.

In the worst scenario I can think of you'd have the Project Explorer open (and active) in the main shell and the Package Explorer detached. If you then select files "A", "B" and "C" in the Project Explorer, then select files "D", "E" and "F" in the Package Explorer then doing "Edit -> Delete" will end up deleting ABC rather than DEF as expected.

Fortunately this doesn't appear to be a very common workflow, presumably most folks that use DW's don't detach the 'navigation' views but usually detach the ancillary views like Search...most of which contain their own menus etc to operate locally on their selection (i.e. not many views actually provide selections for which the main menu would be of use so users don't hit this).
Comment 10 Eric Moffatt CLA 2010-11-11 15:05:28 EST
I've spent some extra time on this since we have the same issue in e4. Unfortunately I'm not sure that a viable fix is even possible here...

SWT:
Clicking on the main shell's menu activates it (seems like correct behavior)
Activating a shell restores its previous focus and ectivation

Us:
If a part gets activated by SWT we make it the active part. This is correct in every situation except this one (i.e. the user may just have clicked on the shell's title area to activate it in which case we want the current behavior.

We have *no* way to detect that the shell going active was the result of the user selecting the main menu.

I've rigged up an SWT testbed to try out various strategies but even if I can prevent the part's activation we just end up with an 'active' part that doesn't have focus and an active shell that doesn't contain the active part...confusing at best.
Comment 11 Eric Moffatt CLA 2010-11-11 15:06:46 EST
Created attachment 182934 [details]
SWT Testbed
Comment 12 Dani Megert CLA 2011-05-18 11:30:55 EDT
See also bug 346279.
Comment 13 Markus Keller CLA 2011-05-18 13:19:37 EDT
This is exactly the same problem as bug 46962. The detached view should be in a palette window that doesn't deactivate the workbench window.
Comment 14 Prakash Rangaraj CLA 2011-05-19 00:24:29 EDT
*** Bug 346279 has been marked as a duplicate of this bug. ***
Comment 15 John CLA 2011-05-24 20:53:01 EDT
probably the most annoying of this bug is when you're looking in a .class file (that you can see its source because it's in a jar to which you attached source) and then you want to click on Project->Properties and find that Properties is grayed out, so you have to click on the exact project(or any files in it)[even though that project is already selected] in the package explorer (not enough to just activate/focus package explorer) in order to ungray the Properties... hmm actually this seems unrelated to this bug, but I thought it's same... can anyone confirm it's unrelated?
Comment 16 Dani Megert CLA 2011-05-25 04:15:23 EDT
(In reply to comment #15)
> probably the most annoying of this bug is when you're looking in a .class file
> (that you can see its source because it's in a jar to which you attached
> source) and then you want to click on Project->Properties and find that
> Properties is grayed out, so you have to click on the exact project(or any
> files in it)[even though that project is already selected] in the package
> explorer (not enough to just activate/focus package explorer) in order to
> ungray the Properties... hmm actually this seems unrelated to this bug, but I
> thought it's same... can anyone confirm it's unrelated?

Yes, this is an unrelated bug. Please file a new one against JDT UI. We need to investigate whether we can register an IProject adapter on those Java elements.
Comment 17 Dani Megert CLA 2011-07-14 05:33:40 EDT

*** This bug has been marked as a duplicate of bug 100909 ***
Comment 18 Dani Megert CLA 2011-07-14 05:39:23 EDT
*** Bug 346279 has been marked as a duplicate of this bug. ***
Comment 19 Dani Megert CLA 2011-07-14 05:39:46 EDT
Reopening, as most of the discussion is in this bug.
Comment 20 Dani Megert CLA 2011-07-14 05:40:22 EDT
.
Comment 21 Dani Megert CLA 2011-07-14 05:40:28 EDT
*** Bug 100909 has been marked as a duplicate of this bug. ***
Comment 22 Dani Megert CLA 2012-08-27 06:29:31 EDT
*** Bug 388066 has been marked as a duplicate of this bug. ***
Comment 23 Mauro Molinari CLA 2014-08-08 09:47:48 EDT
At first I thought this bug were a duplicate of bug 195672, which had some different steps to repro but described the same misbehaviour about the main window main menu bar.
However, while I can't reproduce bug 195672 on Eclipse Luna I20140606-1215, I can still reproduce this one by following the steps to repro in the description.
So this is still valid in current Eclipse.
Comment 24 Chauncey Xu CLA 2014-09-01 02:46:02 EDT
Confirming that this is reproducible in Kepler and Luna. This makes the detached feature unusable especially when the detached editor relies on the contributed menu/toolbar actions to function.
Comment 25 Rolf Theunissen CLA 2019-07-22 10:07:04 EDT
I just noticed that this bug is not triggered in one specif scenario (on Windows). This might give new directions to solve to issue.

1. Make sure the Outline view is visible
2. Open two editors that provide a outline view (e.g. Java editors)
3. Detach one editor
4. Activate the non-detached editor
5. Activate the Outline view
6. Activate the detached editor
7. Select a menu item (e.g. File -> Properties) or toolbar item that apply to the detached editor: It works as expected.

Further observations:
* If after step 6 the main window is activated, the outline does not get activated. Instead the editor in the detached window is still activated (but does not have focus).

But maybe this is 'just' the active shell without active part, and active part without focus. This might seem confusing, but surely less confusing than the current behavior.
Comment 26 Rolf Theunissen CLA 2021-05-17 10:17:56 EDT
*** Bug 573530 has been marked as a duplicate of this bug. ***