I have a menu and toolbar that are defined in plugin.xml and a class that implements a source provider by extending AbstractSourceProvider. The menu is properly hidden but the toolbar with exactly the same visibleWhen is still visible. Since the menu is properly hidden, I'm fairly confident that the source provider is working correctly.

Anyone see why this declaration is not hiding the whole toolbar?

      <menuContribution
        allPopups="false"
        locationURI="menu:org.eclipse.ui.main.menu?before=Window">
     <menu
           label="Data Manager"
           mnemonic="D">
        <command
    command1
        </command>
        <command
    command2
        </command>
        <visibleWhen
              checkEnabled="false">
           <with
                 variable="datamanager.handlers.ShowActions">
              <equals
                    value="showActions">
              </equals>
           </with>
        </visibleWhen>
     </menu>
  </menuContribution>

  <menuContribution
        allPopups="false"
        locationURI="toolbar:org.eclipse.ui.main.toolbar">
     <toolbar
           id="datamanager.toolbar1">
        <command
              command3
        </command>
        <command
              command 4
        </command>
        <visibleWhen
              checkEnabled="false">
           <with
                 variable="datamanager.handlers.ShowActions">
              <equals
                    value="showActions">
              </equals>
           </with>
        </visibleWhen>
     </toolbar>
  </menuContribution>
有帮助吗?

解决方案

This looks like the problem described in Eclipse bug 201589 which has been open for rather a long time.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top