Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 258153 - Making a wizard visible in CPD does not make the New menu visible.
Summary: Making a wizard visible in CPD does not make the New menu visible.
Status: VERIFIED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.5   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.5   Edit
Assignee: Eric Moffatt CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 258158 (view as bug list)
Depends on:
Blocks: 182714
  Show dependency tree
 
Reported: 2008-12-09 14:12 EST by Matthew Bisson CLA
Modified: 2009-06-03 12:57 EDT (History)
2 users (show)

See Also:


Attachments
No longer allow users to hide "Other...", and hide root menus of shortcuts instead (3.29 KB, patch)
2008-12-10 15:53 EST, Matthew Bisson CLA
no flags Details | Diff
Final fix (3.61 KB, patch)
2008-12-16 09:45 EST, Matthew Bisson CLA
emoffatt: iplog+
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Matthew Bisson CLA 2008-12-09 14:12:37 EST
Build ID: I20081209-0100

Steps To Reproduce:
1. Open the CustomizePerspectiveDialog
2. Open the Menu Visibility tab.
3. Uncheck the "New" menu, under the "File" menu.
4. Expand the "New" menu, check "Java Project from Existing Ant Buildfile"
5. Click "Ok".

The File > New menu is not visible.


More information:
It looks like our logic for determining whether to show menus doesn't take the Wizards into account?
Comment 1 Matthew Bisson CLA 2008-12-09 15:47:42 EST
This problem also exists in the Window > Show View and Window > Open Perspective menus - i.e. it is general to shortcuts.
Comment 2 Matthew Bisson CLA 2008-12-10 15:40:45 EST
This problem was aggravated by bug 258158 as all the duplicate menu items had the same id - if any one of them was turned off, they were all turned off. 

The root of the problem is that the New menu (and Open Perspective and Show View) has children contribution items: two separators and the "Other..." menu item, but the new wizards (and perspectives and views) are not contribution items. Thus when the code in MenuManager::isVisible executes, if one has hidden the "Other..." menu item, there are no other non-separator visible children, so the New menu is not displayed, despite having potential new wizards to list.

The fix for bug 258158 is a bit of a hack to only show the "Other..." menu item to the user (i.e. filter out the other menu items, but inject the new wizards which are determined independently). I think the easiest fix for this bug is a modification of the fix for 258158 - simply don't give the user the option to hide the "Other..." menu item (and equivalents for Open Perspective and Show View). These aren't items under the main menus, so the user probably doesn't desperately need to hide it. In order to hide the whole New menu, I'll have to put some special code in, but that will be straight forward. I'll rig a patch together to demonstrate...
Comment 3 Matthew Bisson CLA 2008-12-10 15:53:02 EST
Created attachment 120113 [details]
No longer allow users to hide "Other...", and hide root menus of shortcuts instead

This is the fix described above.

Is is an alternative to attachment 120103 [details] in bug 258158.

The main disadvantage to this approach is that if a new wizard, view or perspective is added through means other than the Customize Perspective Dialog after a user has used the Customize Perspective Dialog to hide the New, Open Perspective or Show View menu, said menu will not regain visibility for the new item, as this is operating as an exception to the rule employed in the CPD that parent visibility is calculated from child visibility - in this case the visibility of the parent itself is stored as it cannot be reliably calculated from the children.
Comment 4 Eric Moffatt CLA 2008-12-12 15:00:19 EST
Matt, let's get together on Monday to go over the various scenarios...
Comment 5 Matthew Bisson CLA 2008-12-16 09:45:11 EST
Created attachment 120575 [details]
Final fix

Eric and I discussed this patch and the patch in bug 258158, and decided to use this one. I've added a comment explaining a portion of the code which seemed out of place.

Changes:
- Don't give users the option to hide "Other..." in shortcuts - it won't be listed in the CPD.
- The mechanism to hide the menus shortcuts are in is to record the menu's id itself.
Comment 6 Matthew Bisson CLA 2008-12-16 09:47:47 EST
*** Bug 258158 has been marked as a duplicate of this bug. ***
Comment 7 Eric Moffatt CLA 2008-12-16 10:26:51 EST
Committed in >20081216. Applied Matt's patch.

I'll take ownership to verify...
Comment 8 Eric Moffatt CLA 2008-12-16 10:27:39 EST
Marking as FIXED.
Comment 9 Eric Moffatt CLA 2009-01-27 13:40:47 EST
Verified in I20090127-0100.