Example usage for org.eclipse.jface.action ToolBarContributionItem setParent

List of usage examples for org.eclipse.jface.action ToolBarContributionItem setParent

Introduction

In this page you can find the example usage for org.eclipse.jface.action ToolBarContributionItem setParent.

Prototype

@Override
    public void setParent(IContributionManager parent) 

Source Link

Usage

From source file:com.nokia.tools.ui.ide.ToolbarHider.java

License:Open Source License

protected void hideExternToolBar() {
    setVisibleForListedIds(false);//  ww  w .  j  a va 2s  . 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);
            }

        }
    }
}