Hi all,
I've created a CoolBar with some icons. Now, if I change some preferences, I want to redraw the CoolBar. But each time if I create the CoolBar a second time the whole widget disappears. Here's my code:
public void createControls(Composite parent) {
this.top = parent;
// create some managers...
CoolBarManager coolbarmgr = new CoolBarManager(SWT.NONE);
IToolBarManager toolbarmgr = new ToolBarManager(SWT.FLAT | SWT.BOTTOM);
CoolBar coolbar1 = coolbarmgr.createControl(top);
ToolBar toolBar1 = new ToolBar(coolbar1, SWT.FLAT);
coolbarmgr.add(new ToolBarContributionItem(toolbarmgr));
// create a nice tool item
createToolItem(toolBar1, CommandIds.CMD_SOMETHING,
Icon.MY_ICON.getImage(IconSize.ToolbarIconSize), preferences.getBoolean(Constants.TOOLBAR_SHOW_SOMETHING));
In createToolItem() I do
ToolItem item = new ToolItem(toolBar, SWT.PUSH);
// some item configurations
And here's my update method:
protected void recreateCoolBar() {
// doesn't work :-( => the coolbar is completely empty after re-creating...
coolbarmgr.removeAll();
createControls(top);
}
Does anybody out there have an idea how can I dynamically change the CoolBar items? Thanks in advance.
Greetz,
Ralf.