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

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.


[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 Sep 27 09:20:31 GMT 2022

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

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

Back to the top