Inserting an Action button from an AbstractPropertySection
I have a tabbed propertiesContributor (and a few propertySections to go with it) using the org.eclipse.ui.views.properties.tabbed.propertySections extension point
I should like to place a tab-specific 'refresh' action-button into the action-bar, and cannot see how it should be done. There is a very tantalising method ..
TabbedPropertySheetPage.setActionBars( ... )
... available in 'createControls()' but I cannot see how I make use of that.
C开发者_如何学JAVAan anyone point me at some working example code on how to achieve this?
Your clues & boos are most welcome.
M.
The solution was to use an instance of org.eclipse.ui.SubActionBars and add the tab-specific Actions to it, like this ...
@Override
public void createControls(Composite parent, final TabbedPropertySheetPage aTabbedPropertySheetPage)
{
...
makeActions();
subActionBars = new SubActionBars( tabbedPropertySheetPage.getSite().getActionBars() );
subActionBars.getToolBarManager().add( refreshAction );
subActionBars.getMenuManager().add( refreshAction );
}
.. then override aboutToBeShown() and aboutToBeHidden() like this ...
@Override
public void aboutToBeShown()
{
super.aboutToBeShown();
subActionBars.activate();
subActionBars.updateActionBars();
}
@Override
public void aboutToBeHidden()
{
super.aboutToBeHidden();
subActionBars.deactivate();
subActionBars.updateActionBars();
}
I don't think there is a way to add a Tab specific action to the view's action bar. You may have to add the action in a section of that tab only.
精彩评论