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

Bug 55295

Summary: [ViewMgmt] View menu is shown even if all of its items are invisible
Product: [Eclipse Project] Platform Reporter: Nick Edgar <n.a.edgar>
Component: UIAssignee: Remy Suen <remy.suen>
Status: VERIFIED FIXED QA Contact: Remy Suen <remy.suen>
Severity: normal    
Priority: P5 CC: bokowski, daniel_megert, douglas.pollock, hudsonr, markus.kell.r, pwebster
Version: 3.0   
Target Milestone: 3.7 M6   
Hardware: All   
OS: All   
Whiteboard:
Attachments:
Description Flags
ViewPane patch v1
none
ViewPane patch v2 none

Description Nick Edgar CLA 2004-03-18 16:50:24 EST
build I20040318

- show the Outline view
- open a Java editor
- it has view toolbar contributions and view menu contributions
- the view menu triangle shows correctly
- close the editor
- the contributions are gone, but the triangle still shows
- click on the triangle
- it disappears
Comment 1 Nick Edgar CLA 2004-09-22 16:27:20 EDT
Still occurs in M2, except for the last two steps: the triangle no longer
disappears.
Comment 2 Boris Bokowski CLA 2005-09-13 14:37:29 EDT
*** Bug 106570 has been marked as a duplicate of this bug. ***
Comment 3 Markus Keller CLA 2006-04-27 11:32:46 EDT
*** Bug 68242 has been marked as a duplicate of this bug. ***
Comment 4 Boris Bokowski CLA 2007-06-20 14:06:11 EDT
*** Bug 67145 has been marked as a duplicate of this bug. ***
Comment 5 Boris Bokowski CLA 2009-11-11 17:30:58 EST
Remy is now responsible for watching the [ViewMgmt] category.
Comment 6 Remy Suen CLA 2009-12-08 09:42:45 EST
Still broken on I20091208-0100.

May be a problem with the 'Outline' view itself. If I use the following code in a simple view the dropdown appears and disappears as expected.

IActionBars bars = getViewSite().getActionBars();
IMenuManager menuManager = bars.getMenuManager();
if (show) {
  menuManager.add(action1);
  menuManager.updateAll(true);
} else {
  menuManager.removeAll();
  menuManager.updateAll(true);
}
Comment 7 Remy Suen CLA 2010-04-27 13:42:42 EDT
Hit a variant of this while testing I20100426-0852.

1. Open a Java file. The 'Outline' view is populated and the view menu is visible.
2. Open a build.properties file. The 'Outline' view is updated but the view menu is still there. Clicking on it does nothing. If you close them all and reopen the build.properties file, you will see that the 'Outline' view was not supposed to have a view menu.
Comment 8 Remy Suen CLA 2010-12-15 14:02:00 EST
This seems to be because ViewPane's hasViewMenu() returns 'true'. Even when there are no editors showing, the menu manager still appears to have the lingering Java actions in it despite the fact that the editors have been closed.
Comment 9 Remy Suen CLA 2010-12-15 14:47:20 EST
Created attachment 185257 [details]
ViewPane patch v1

Fix to more accurately calculate whether the view menu should be shown or not based on the visibility of the menu manager's items.
Comment 10 Remy Suen CLA 2010-12-15 15:05:49 EST
Created attachment 185259 [details]
ViewPane patch v2

Separators (and group markers) also need to be ignored. If separators aren't considered, then the 'Search' view will have a view menu after performing a 'Plug-in Search' even though clicking on the drop down won't actually show anything.
Comment 11 Remy Suen CLA 2011-01-31 08:34:49 EST
(In reply to comment #10)
> Created attachment 185259 [details]
> ViewPane patch v2

Patch released to HEAD with the copyright header tweaked to 2011.
Comment 12 Remy Suen CLA 2011-03-08 09:00:58 EST
Verified with I20110307-2110 on Windows XP.