Hi guys,
I have a SharedHeaderFormEditor with it's shared HeaderForm. I also have two IFormPages added to it. The head of the HeaderForm has set an icon and a text. I would like to add an Action to the shared HeaderForm when the second page is selected and remove this Action when it's unselected.
So I have this code in the second page:
@Override
public void setActive(boolean active) {
super.setActive(active);
if (active) {
IManagedForm headerForm = ((SharedHeaderFormEditor) getEditor()).getHeaderForm();
headerForm.getForm().getToolBarManager().add(getVerticalAction());
headerForm.getForm().updateToolBar();
} else {
headerForm.getForm().getToolBarManager().remove(getVerticalAction().getId());
headerForm.getForm().updateToolBar();
}
}
private IAction getVerticalAction() {
if (verticalAction == null) {
verticalAction = new Action(null, Action.AS_RADIO_BUTTON) {
@Override
public void run() {
.....
}
};
verticalAction.setId("verticalAction");
verticalAction.setChecked(true);
verticalAction.setToolTipText("vertical");
verticalAction.setImageDescriptor(myImageDescriptor);
}
return verticalAction;
}
This way the action is added/removed properly but the toolbar has gray background until I minimize and maximize or move the entire workbench window. I tried call all of this
headerForm.reflow(true);
headerForm.refresh();
headerForm.getForm().getParent().redraw();
headerForm.getForm().getParent().update();
headerForm.getForm().getParent().layout();
headerForm.getForm().getForm().getHead().redraw();
headerForm.getForm().getForm().getHead().update();
headerForm.getForm().getForm().getHead().layout();
headerForm.getForm().getForm().redraw();
headerForm.getForm().getForm().update();
headerForm.getForm().getForm().layout();
but nothing helps. Am I missing something about toolbars?
[Updated on: Thu, 03 March 2011 22:36]
Report message to a moderator