Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Rich Client Platform (RCP) » Re-creating CoolBar(CoolBar disappears if created a second time)
Re-creating CoolBar [message #1724427] Tue, 23 February 2016 21:02
Ralf Heydenreich is currently offline Ralf HeydenreichFriend
Messages: 221
Registered: July 2009
Senior Member
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.
Previous Topic:Plugin Tracing options not picked up by Eclipse
Next Topic:Dynamically Perspectives in RCP application
Goto Forum:
  


Current Time: Wed Dec 02 13:27:31 GMT 2020

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

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

Back to the top