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

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

Introduction

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

Prototype

public IContributionManager getParent() 

Source Link

Document

Returns the parent contribution manager, or null if this contribution item is not currently added to a contribution manager.

Usage

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);
            }

        }
    }
}