Skip to main content


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: 69
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 do I open a file from my table with a button click?
Goto Forum:
  


Current Time: Thu Mar 28 22:38:11 GMT 2024

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

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

Back to the top