Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » toolbar command enablement
toolbar command enablement [message #551603] Sat, 07 August 2010 22:31 Go to next message
Sebastian is currently offline SebastianFriend
Messages: 26
Registered: July 2009
Junior Member
Hi,

I have a Command (the class extends AbstractHandler) where I overrided
the isEnabled-Method. It checks some specific things about the selection
of the user and returns true or false accordingly.
Now I want the toolbar to show the command. So I used the
menuContribution extension and a a command extension. The problem is
that the isEnabled method is only called ones but not another time if
the user selects other elements in a view.
I've also used the visibleWhen extension (with checkEnabled=true) but it
doesn't work.
What can I do that the isEnabled-method is being called when the user
selects elements in the view?

Thanks a lot.
Re: toolbar command enablement [message #551697 is a reply to message #551603] Mon, 09 August 2010 08:27 Go to previous message
T. Wilhelm is currently offline T. WilhelmFriend
Messages: 129
Registered: July 2009
Senior Member
The isEnabled Method will only be called if the menu entry is created. Thats why that method works for menus like popup or main menus, but not for toolbars.

If you want to disable the toolbar button, you have to add an "enabledWhen" condition on your handler. Maybe the declarative expressions are enough for you, if you have to do some specific checks, i.e. check a right or something else which you can only do programmatically, you have to write either a propertyTester or a sourceProvider.

Greetz
Thomas

[Updated on: Mon, 09 August 2010 08:29]

Report message to a moderator

Previous Topic:How do I know the position of mouse is above the focused TreeNode
Next Topic:toggle state
Goto Forum:
  


Current Time: Tue Dec 07 01:40:51 GMT 2021

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

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

Back to the top