Skip to main content



      Home
Home » Eclipse Projects » Eclipse Platform » How to disable/hide a menu item
How to disable/hide a menu item [message #666413] Wed, 20 April 2011 07:26 Go to next message
Eclipse UserFriend
Id like to disable (or hide) a menu item of my plugin if program is in certain state. I tried implementing "isEnabled" in respective command's handler -- this would restrict executing the command (a message pops up saying "the chosen operation is not enabled") but the menu item is neither hidden nor disabled until it's clicked once.

I tried setting "checkEnabled"=true in menu definition under visibleWhen in plugin.xml, but it didn't help

I really hope it's possible to do it without using a MenuItemStateProviderNotifierService Smile

[Updated on: Wed, 20 April 2011 07:45] by Moderator

Re: How to disable/hide a menu item [message #666478 is a reply to message #666413] Wed, 20 April 2011 09:58 Go to previous messageGo to next message
Eclipse UserFriend
You use org.eclipse.ui.menus and a visibleWhen clause on your command
menu item.

PW


--
Paul Webster
http://wiki.eclipse.org/Platform_Command_Framework
http://wiki.eclipse.org/Command_Core_Expressions
http://wiki.eclipse.org/Platform_Expression_Framework
http://wiki.eclipse.org/Menu_Contributions
http://wiki.eclipse.org/Menus_Extension_Mapping
http://help.eclipse.org/helios/index.jsp?topic=/org.eclipse. platform.doc.isv/guide/workbench.htm
Re: How to disable/hide a menu item [message #667026 is a reply to message #666478] Tue, 26 April 2011 10:39 Go to previous message
Eclipse UserFriend
I finally got my thing working (by using a custom PropertyTester). But I was not able to use "visibleWhen" without any children and checkEnabled=true -- according to documentation it should delegate decision to command's (or command handler's?) "isEnabled", but it didn't work like that.

[Updated on: Tue, 26 April 2011 10:39] by Moderator

Previous Topic:UpdateManager Reconciling
Next Topic:CompareEditor throwing Null Exception when selected
Goto Forum:
  


Current Time: Thu Jul 03 06:32:43 EDT 2025

Powered by FUDForum. Page generated in 0.14673 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top