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):
- for menu items, the
@CanExecute
methods were invoked each time a menu was shown - for toolbar items, there was a timer that invoked the
@CanExecute
methods every 400ms
Is this a known bug in Luna? Do you know any possible workaround to achieve the expected behaviour?
Thanks!