Search in sources :

Example 1 with IActionBarConfigurer

use of org.eclipse.ui.application.IActionBarConfigurer in project translationstudio8 by heartsome.

the class ApplicationWorkbenchWindowAdvisor method postWindowCreate.

/**
	 * 删除 RCP 自带的工具栏按钮
	 */
public void postWindowCreate() {
    IActionBarConfigurer actionBarConfigurer = getWindowConfigurer().getActionBarConfigurer();
    IContributionItem[] coolItems = actionBarConfigurer.getCoolBarManager().getItems();
    for (int i = 0; i < coolItems.length; i++) {
        if (coolItems[i] instanceof ToolBarContributionItem) {
            ToolBarContributionItem toolbarItem = (ToolBarContributionItem) coolItems[i];
            if (toolbarItem.getId().equals("org.eclipse.ui.WorkingSetActionSet") || toolbarItem.getId().equals("org.eclipse.ui.edit.text.actionSet.annotationNavigation") || toolbarItem.getId().equals("org.eclipse.ui.edit.text.actionSet.navigation")) {
                toolbarItem.getToolBarManager().removeAll();
            }
        }
    }
    actionBarConfigurer.getCoolBarManager().update(true);
    addAutoPluginMenu();
}
Also used : ToolBarContributionItem(org.eclipse.jface.action.ToolBarContributionItem) IContributionItem(org.eclipse.jface.action.IContributionItem) IActionBarConfigurer(org.eclipse.ui.application.IActionBarConfigurer)

Aggregations

IContributionItem (org.eclipse.jface.action.IContributionItem)1 ToolBarContributionItem (org.eclipse.jface.action.ToolBarContributionItem)1 IActionBarConfigurer (org.eclipse.ui.application.IActionBarConfigurer)1