Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 339982 - MenuContribution with visibleWhen Expression still visible when false
Summary: MenuContribution with visibleWhen Expression still visible when false
Status: RESOLVED FIXED
Alias: None
Product: e4
Classification: Eclipse Project
Component: UI (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows 7
: P3 normal (vote)
Target Milestone: 4.1 RC2   Edit
Assignee: Remy Suen CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-03-15 05:11 EDT by Thomas Kratz CLA
Modified: 2011-05-17 15:04 EDT (History)
1 user (show)

See Also:


Attachments
Menu contributions patch v1 (2.35 KB, patch)
2011-05-17 14:27 EDT, Remy Suen CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
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.