Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    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 11:26 Go to next message
Aivar Annamaa is currently offline Aivar AnnamaaFriend
Messages: 33
Registered: July 2009
Member
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 11:45]

Report message to a moderator

Re: How to disable/hide a menu item [message #666478 is a reply to message #666413] Wed, 20 April 2011 13:58 Go to previous messageGo to next message
Paul Webster is currently offline Paul WebsterFriend
Messages: 6859
Registered: July 2009
Location: Ottawa
Senior Member

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 14:39 Go to previous message
Aivar Annamaa is currently offline Aivar AnnamaaFriend
Messages: 33
Registered: July 2009
Member
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 14:39]

Report message to a moderator

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


Current Time: Fri Apr 19 00:51:14 GMT 2024

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

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

Back to the top