Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » JFace » How to change enablement state of ControlContribution(Updating toolbar has no effect)
How to change enablement state of ControlContribution [message #997489] Mon, 07 January 2013 18:45
Mark Leone is currently offline Mark LeoneFriend
Messages: 67
Registered: April 2012
Member
I have a ControlContribution that I've added to a ToolBar in a ViewPart. I want to change its enabled state depending on the state of a resource known to the ViewPart code. I tried passing the ControlContribution item a reference to the view, and overriding the enablement method, like this:

@Override
public boolean isEnabled() {
   return this.myView.isResourceReady();
}


But I don't know how to tell the ToolBarManager that the resource status has changed. Whenever it changes, I call

toolBarManager.update(true);


but this doesn't change the enablement state of the ControlContribution--it's always enabled.

I also tried calling

controlContribution.setVisible(false);


when I cerate controlContribution. This makes it not visible, but then there is no way to make it visible when the resource status changes. I invoke

controlContribution.setVisible(true);
toolBarManager.update(true);


But controlContribution does not become visible.
Previous Topic:How to display ToolTip on Mouse Hover over VerticalRuler
Next Topic:How alignment done in this UI
Goto Forum:
  


Current Time: Thu Nov 27 11:11:49 GMT 2014

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

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