if ((coolItemToolBarMgr != null) && (!isAdjunctType)) {
return coolItemToolBarMgr;
}
// Search for toolBarId in the cool Bar manager
IContributionItem cbItem = coolBarManager.find(toolBarId);
// If there hasn't been a tool bar contribution item created for this
// tool bar
// id then create one. Otherwise retrieve the tool bar contribution
// item
if (cbItem instanceof IToolBarContributionItem) {
IToolBarContributionItem tbcbItem = (IToolBarContributionItem) cbItem;
coolItemToolBarMgr = tbcbItem.getToolBarManager();
// If this not an adjuct type then we can cashe the tool bar
// contribution type
if (!isAdjunctType) {
toolBarContributionItem = tbcbItem;
}
} else {
coolItemToolBarMgr = actionBarConfigurer.createToolBarManager();
// If this is not an adjunct type then create a tool bar
// contribution item
// we don't create one for an adjunct type because another action
// set action bars contains one
IContributionItem toolBarContributionItem = actionBarConfigurer
.createToolBarContributionItem(coolItemToolBarMgr,
toolBarId);
toolBarContributionItem.setParent(coolItemToolBarMgr);
toolBarContributionItem.setVisible(getActive());
coolItemToolBarMgr.markDirty();
// Now add the tool bar contribution Item to the cool bar manager
IContributionItem refItem = findAlphabeticalOrder(
IWorkbenchActionConstants.MB_ADDITIONS, toolBarId,
coolBarManager);
if (refItem != null) {
coolBarManager.insertAfter(refItem.getId(),
toolBarContributionItem);
} else {
coolBarManager.add(toolBarContributionItem);
}
}