I'm having a problem with command handlers in Eclipse Luna RCP.
In my E4 application model, I defined some commands and related handlers that must be enabled
only under certain circumstances. For this reason, in my handler POJOs, I implemented
methods annotated with @CanExecute where I check the required conditions.
I also defined menu and toolbar items associated with those commands.
The problem is that my @CanExecute methods aren't properly invoked and, as a consequence,
menu and toolbar items aren't enabled/disabled accordingly.
In particular, for menu items, the @CanExecute methods are only invoked a few times at application startup, but never after that.
For toolbar items, instead, the @CanExecute methods are only invoked when the active context changes (e.g. when changing the active part or opening a new shell).
In Kepler, the behaviour was quite different (and worked as expected):
@CanExecute methods were invoked each time a menu was shown@CanExecute methods every 400msIs this a known bug in Luna? Do you know any possible workaround to achieve the expected behaviour?
Thanks!
This is a design change in Eclipse Luna described in bug 427465, also 436755
You can get the toolbar @CanExecute methods run using:
eventBroker.send(UIEvents.REQUEST_ENABLEMENT_UPDATE_TOPIC, UIEvents.ALL_ELEMENT_ID);
'eventBroker' is the IEventBroker.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With