Hi Jack,
which kind of coolbar do you mean?
The "Main"-Coolbar of the Eclipse RCP Application or a Coolbar, which you have created yourself?
Main Toolbar can be accessed like that:
In this example I add a toolbar to the main coolbar and then add a certain command to it.
<extension
point="org.eclipse.ui.menus">
<menuContribution
allPopups="false"
locationURI="toolbar:org.eclipse.ui.main.toolbar">
<toolbar
id="toolbar"
label="%toolbar">
<command
commandId="your.command.id"
style="push"
tooltip="%your.command.tooltip">
</command>
</toolbar>
</menuContribution>
For a "selfmade" Coolbar you should use the org.eclipse.ui.menus.IMenuService to fill the Coolbar with Commands:
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench()
.getActiveWorkbenchWindow().getService(IMenuService.class);
CoolBarManager coolbarManager = new org.eclipse.jface.action.CoolBarManager();
coolbarManager.createControl(parent);
menuService.populateContributionManager(
coolbarManager,
"locationURI.of.your.menuContribution.which.contains.the.desired.command"); //$NON-NLS-1$
I hope this helps.
Otherwise do not hesitate to ask further questions
Best regards,
Simon