List of usage examples for org.eclipse.jface.action ToolBarContributionItem getParent
public IContributionManager getParent()
null if this contribution item is not currently added to a contribution manager. From source file:com.nokia.tools.ui.ide.ToolbarHider.java
License:Open Source License
protected void hideExternToolBar() { setVisibleForListedIds(false);/* w ww .j av a2s. c o m*/ CoolBar coolBar = getMainCoolBar(); if (null == coolBar) return; for (CoolItem item : ((CoolBar) coolBar).getItems()) { // check disposed, can happen when reset perspective if (!item.isDisposed() && item.getData() instanceof ToolBarContributionItem) { ToolBarContributionItem toolbaritem = ((ToolBarContributionItem) item.getData()); if (shouldRemoveGroup(toolbaritem)) { CoolBarManager mngr = (CoolBarManager) toolbaritem.getParent(); if (null == mngr) { mngr = ((ApplicationWindow) PlatformUI.getWorkbench().getActiveWorkbenchWindow()) .getCoolBarManager(); toolbaritem.setParent(mngr); mngr.refresh(); } IContributionItem remitem = mngr.remove(toolbaritem); if (null != remitem) removedItems.add(remitem); mngr.update(true); } } } }