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

Bug 348817

Summary: WTP Source Editing Source/Refactor menus are visible and empty
Product: [Eclipse Project] e4 Reporter: Bryan Hunt <bhunt>
Component: UIAssignee: Paul Webster <pwebster>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: bokowski, emoffatt, Mike_Wilson, pwebster, remy.suen, thatnitind
Version: 1.0Flags: Mike_Wilson: pmc_approved+
remy.suen: review+
Target Milestone: 4.1 RC4   
Hardware: PC   
OS: All   
Whiteboard:
Bug Depends on:    
Bug Blocks: 334303    
Attachments:
Description Flags
screenshot of menubar
none
screenshot of installed software
none
Update the menu bar on workbench changes v01
none
Show main menu items v01
none
Update the Menu bar model children
none
Update the Menu bar model children v02
none
Update the Menu bar model children v03 none

Description Bryan Hunt CLA 2011-06-08 17:49:35 EDT
Created attachment 197652 [details]
screenshot of menubar

I downloaded 4.1RC3 installed some features from Indigo p2 repo, and now I have duplicate Source and Refactor menus.  The features I installed are:

DataTools
EMF SDK
JavaScript Development Tools
M2E
Marketplace Client
Mylyn
Web Page Editor
Comment 1 Bryan Hunt CLA 2011-06-08 17:50:45 EDT
Created attachment 197654 [details]
screenshot of installed software
Comment 2 Bryan Hunt CLA 2011-06-08 17:58:20 EDT
I just discovered that the Package Explorer view must be active to get the duplicate menus.  If you switch to another view such as the Outline view, the duplicate menus go away.

I also forgot to mention that the duplicated menus are empty.
Comment 3 Paul Webster CLA 2011-06-09 06:41:32 EDT
In my case, they come from WTP Source Editing (they're different than the JDT menus).  And without the correct parts up they're empty.  In 3.x, they are there as well, but the system doesn't render empty MenuManagers.

PW
Comment 4 Paul Webster CLA 2011-06-10 15:25:46 EDT
Created attachment 197809 [details]
Update the menu bar on workbench changes v01

This speeds up the disappearance of the extra, empty menus.

However, the menus are still shown until the user "arms" them (so they show up empty once).

PW
Comment 5 Paul Webster CLA 2011-06-10 15:36:42 EDT
Created attachment 197813 [details]
Show main menu items v01

After our WorkbenchWindow create the main menu bar, send each top level item an SWT.Show.

This evaluates the visibility of all of the top level menus, and voila the extra menus disappear.

This will create widgets for all of the next-level entries even though the user has not shown them.

PW
Comment 6 Paul Webster CLA 2011-06-10 15:46:27 EDT
Created attachment 197816 [details]
Update the Menu bar model children

This is probably less costly than firing an SWT.Show event.  It evaluates the visibility of the model children of the main menu items.

That will set all of the model items (and hence the IContributionItems) to visible==false in the case of these menus, so that the next menu bar update(true) will clear out the empty menus.

PW
Comment 7 Paul Webster CLA 2011-06-10 20:37:45 EDT
Considering for GA
PW
Comment 8 Remy Suen CLA 2011-06-13 08:51:30 EDT
When I open an XSD file, I now see a 'Design' menu but the 'Refactor' menu seems to have disappeared.
Comment 9 Bryan Hunt CLA 2011-06-13 09:02:59 EDT
(In reply to comment #8)
> When I open an XSD file, I now see a 'Design' menu but the 'Refactor' menu
> seems to have disappeared.

see bug 348818
Comment 10 Paul Webster CLA 2011-06-13 13:26:35 EDT
Created attachment 197904 [details]
Update the Menu bar model children v02

The menu bar doesn't receive SWT.Show events, and so has no hooks to know when it needs to do visibility processing.

This uses the submenu children model processing to determine if there are any visible children.  But just like always-visible tool items, it requests menu bar processing in the timerExec(*).

Quick measurements of the system indicate one timerExec takes between 20 and 24 ms, and our timerExec runs every 400 ms.

PW
Comment 11 Paul Webster CLA 2011-06-13 13:27:04 EDT
Remy, could you review this one?

PW
Comment 12 Paul Webster CLA 2011-06-13 13:59:02 EDT
Created attachment 197909 [details]
Update the Menu bar model children v03

Same as v02, but the WorkbenchWindow Runnable is executed in a SafeRunner so it won't kill the timerExec on catastrophic failure.

PW
Comment 13 Remy Suen CLA 2011-06-13 14:49:48 EDT
(In reply to comment #12)
> Created attachment 197909 [details]
> Update the Menu bar model children v03

Confirmed that the empty menus go away.

Please update the copyright headers for MenuManagerRendererFilter and ContextService.
Comment 14 Mike Wilson CLA 2011-06-14 10:11:43 EDT
This is clearly a tactical fix to get things working for 4.1. We will need to revisit this after we ship. It's a brute force way to force the menu bar to be updated properly, but it will do for now.
Comment 15 Paul Webster CLA 2011-06-14 10:40:36 EDT
Released and scheduled a build I20110614-1045
PW