visibleWhen and core expressions [message #1409997] |
Tue, 19 August 2014 10:20  |
Eclipse User |
|
|
|
Hi, I have a problem making a command visible only when certain part is active. I have taken this approach
http://www.eclipse.org/forums/index.php/t/452233/
however, it seems that the core expression only gets evaluated at startup. When I change the context variable by calling context.set or even context.modify, the state of the command does not get updated. The almighty Lars Vogel, taking the same approach in his tutorial
http://www.vogella.com/tutorials/EclipseRCP/article.html#commandsmore_coreexpressionsown,
does not seem to face such an issue. How come?
Are core expressions supposed to get re-evaluted when the DI context changes? If not, how can I force re-evaluation? I know there is a method IEvaluationService.requestEvaluation but I couldn't obtain instance of the IEvaluationService through dependency injection. Should I obtain it by some 3.x way? Does not the e4 have some new and more fancy ways of handling the evaluation of core expressions?
Thanks.
[Updated on: Tue, 19 August 2014 10:22] by Moderator
|
|
|
|
|
Re: visibleWhen and core expressions [message #1413718 is a reply to message #1412093] |
Fri, 29 August 2014 05:02  |
Eclipse User |
|
|
|
Hi Dirk,
thank you for your answer. I was aware of this bug but did not read it cerafully enough. Well, I have found that core-expressions are just not getting updated when you change a variable in IEclipseContext. I have found how to force the re-evaluation of expressions using the ExpressionsContext. However, even if the visibility is set, the MenuItems do not react on it. I have to manually dig in the SWT MenuRenderer and refresh it myself. I have written my own addon which does that. However, things got even more complicated after that and after whole day of investigenting this issue I decided to give up. I am returning to 3.x.
|
|
|
Powered by
FUDForum. Page generated in 0.03851 seconds