Skip to main content

Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » MHandledToolItem visibleWhen not working?
MHandledToolItem visibleWhen not working? [message #946625] Tue, 16 October 2012 10:59
François POYER is currently offline François POYERFriend
Messages: 6
Registered: December 2009
Junior Member
I'm trying to have a part's toolbar content change dynamically.
What I've done so far is:
MPart myPart;

MRenderedToolBar toolbar = MMenuFactory.INSTANCE.createRenderedToolBar();

MHandledToolItem item = MMenuFactory.INSTANCE.createHandledToolItem();

Expression visWhen = new CoreExpression() {
    public EvaluationResult evaluate(IEvaluationContext context) {
        // some code evaluating whether this item of the toolbar should be visible or not.
MCoreExpression isVisibleWhenExpression = MUiFactory.INSTANCE.createCoreExpression();




I've been doing this with a MPopupMenu and some MHandledMenuItem somewhere else in my code and this works like a charm (the menu items show or not in the popup menu depending on the return of the CoreExpression's evaluate, as expected).

But here, the evaluate method of my CoreExpression seems to be never called. Am I doing something wrong or is this a bug or intended feature?

Right now I'm working around that with a selection listener changing the MHandledToolItem's visible and toBeRendered attributes but that's far from perfect...

Also I've tried creating and using a MToolBar instead of the MRenderedToolBar but that doesn't seem to change anything... what's the difference between the two by the way?
Previous Topic:Questions regarding @Creatable
Next Topic:How to find DirectMenuItem programmatically
Goto Forum:

Current Time: Wed Apr 21 06:14:16 GMT 2021

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

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

Back to the top