Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Eclipse 4 » MToolControl.setVisible(true) changes not immediately reflected in status bar
MToolControl.setVisible(true) changes not immediately reflected in status bar [message #1724538] Wed, 24 February 2016 13:33 Go to next message
Andreas Sewe is currently offline Andreas SeweFriend
Messages: 111
Registered: June 2013
Senior Member
Hi,

I have a Tool Control registered in a model fragment and contributed to the Eclipse IDE's status bar. Now, I want to show & hide the control depending on a preference. At the moment, I am using the following code:

    private MToolControl modelElement;

    @Inject
    public MyToolControl(MToolControl modelElement) {
        this.modelElement = modelElement;
    }

    @Inject
    public void setVisible(@Preference(PREF_VISIBLE) boolean visible) {
        modelElement.setVisible(visible);
    }

This does not quite work, yet, however: When I set PREF_VISIBLE to false, setVisible is called (as expected) and the tool control vanishes from the status bar. If I set PREF_VISIBLE to true again, setVisible is again called, but the UI does not change immediately. Instead, I have to switch focus from the workbench window and back again to case the UI to be updated.

I suspect I need to notify the framework about this model change somehow. What am I missing (and why am I not missing it when it comes to making my MToolControl invisible rather than visible)?
Re: MToolControl.setVisible(true) changes not immediately reflected in status bar [message #1725758 is a reply to message #1724538] Mon, 07 March 2016 13:11 Go to previous message
Andreas Sewe is currently offline Andreas SeweFriend
Messages: 111
Registered: June 2013
Senior Member
For the benefit of others, I solved the issue by using to be rendered rather than visible:

modelElement.setToBeRendered(visible)
Previous Topic:Installed eclipse Mars and facing issues
Next Topic:Making a Tool Item's Menu appear programmatically
Goto Forum:
  


Current Time: Fri Apr 26 13:52:29 GMT 2024

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

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

Back to the top