Skip to main content



      Home
Home » Eclipse Projects » Rich Client Platform (RCP) » toolbar command enablement
toolbar command enablement [message #551603] Sat, 07 August 2010 18:31 Go to next message
Eclipse UserFriend
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 04:27 Go to previous message
Eclipse UserFriend
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 04:29] by Moderator

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


Current Time: Mon Jul 07 12:43:52 EDT 2025

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

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

Back to the top