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

Bug 339982

Summary: MenuContribution with visibleWhen Expression still visible when false
Product: [Eclipse Project] e4 Reporter: Thomas Kratz <eiswind>
Component: UIAssignee: Remy Suen <remy.suen>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: pwebster
Version: unspecified   
Target Milestone: 4.1 RC2   
Hardware: PC   
OS: Windows 7   
Whiteboard:
Attachments:
Description Flags
Menu contributions patch v1 none

Description Thomas Kratz CLA 2011-03-15 05:11:24 EDT
Build Identifier: e4.1 M6

Hi I contibute a menu with some items with a visiblewhen expression. After SourceProviders are working now the items work fine but the menu itself still is there when the expression is false

<menuContribution
         allPopups="true"
         locationURI="menu:org.eclipse.ui.main.menu?after=additions">
      <menu
            id="de.eiswind.mango.client.menu.admin"
            label="%administration"
            tooltip="%administration">
         
         <visibleWhen>
               	 <with
                     variable="de.eiswind.mango.client.core.user.isadmin">
                    <equals  value="enabled">
                    </equals>
                  
               </with>
           	 </visibleWhen>
   </menu>
   </menuContribution>

Reproducible: Always

Steps to Reproduce:
1. create a menu with visibleWhen= false
2. menu is still visible
3.
Comment 1 Thomas Kratz CLA 2011-03-27 06:22:42 EDT
Can anyone take a look at this? Would be great if I could hide the menu after all that it has no items.
Comment 2 Remy Suen CLA 2011-05-17 14:27:44 EDT
Created attachment 195903 [details]
Menu contributions patch v1

Change our menu contribution to have a visibleWhen expression set on it. Also altered the code so that if a contribution goes to the menu bar, we are always tracking its visibility even if the menu contribution itself doesn't have an expression (as one of its children may have one).
Comment 3 Paul Webster CLA 2011-05-17 15:02:09 EDT
Looks fine, released to HEAD
PW
Comment 4 Remy Suen CLA 2011-05-17 15:04:11 EDT
Thank you for the bug report, Thomas! Sorry it took so long to get back to you on this.