using command handlers to enable/disable push buttons [message #332158] |
Tue, 07 October 2008 17:35  |
Eclipse User |
|
|
|
Hi,
I am a beginner at using the commands and commands expressions framework.
It seems pretty straightforward to setup handlers to enable/disable
buttons on the toolbar using the extensions. However, how would I go about
enabling/disabling regular SWT push buttons? Is there some way to access
the handler I've declared in the extension point programmatically and
evaluate the handler's expression? Or can it even be done through
extension points ?
Thanks,
Eric
|
|
|
|
Re: using command handlers to enable/disable push buttons [message #332175 is a reply to message #332171] |
Wed, 08 October 2008 12:43   |
Eclipse User |
|
|
|
Paul Webster wrote:
> You would like to create SWT Buttons (instead of menu items or tool items)?
> If that's the case, you can create a CommandContributionItem yourself
> and call cci.fill(parentComposite)
> That will create a button and hook it up so it calls the command when
> pushed. It should also keep the button enabled state up to date,
> although that might need a little help from a ContributionManager. Try
> it out with the cci.fill(*) and see if that helps.
> If that's not what you were after, is there some other way you could
> describe it?
> PW
Currently, I am calling the command from the button by simply finding the
command using the IHandlerService and then executing it. I thought there
might be something similar for accessing the command's handler and tying
the button's enablement state to the handler's expression from the
extension point.
I am not familiar with creating a CommandContributionItem, so I will look
into this. It sounds like this may be what I need to do to tie the SWT
button's enabled state to the handler's expression.
Thanks!
Eric
Thanks,
Eric
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04724 seconds