本文整理汇总了Java中org.eclipse.jface.action.ICoolBarManager.update方法的典型用法代码示例。如果您正苦于以下问题:Java ICoolBarManager.update方法的具体用法?Java ICoolBarManager.update怎么用?Java ICoolBarManager.update使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.ICoolBarManager
的用法示例。
在下文中一共展示了ICoolBarManager.update方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: hideUnrelatedUI
import org.eclipse.jface.action.ICoolBarManager; //导入方法依赖的package包/类
/** Remove toolbar and menu entries unrelated to the display builder
* @param page {@link IWorkbenchPage}
*/
public static void hideUnrelatedUI(final IWorkbenchPage page)
{
// Hide BOY "Top Files" tool bar drop-down
page.hideActionSet("org.csstudio.opibuilder.actionSet");
// Hide "Search" (git, file) from tool bar
page.hideActionSet("org.eclipse.search.searchActionSet");
if (! (page.getWorkbenchWindow() instanceof WorkbenchWindow))
return;
final WorkbenchWindow window = (WorkbenchWindow)page.getWorkbenchWindow();
final ICoolBarManager toolbar = window.getCoolBarManager2();
for (IContributionItem item : toolbar.getItems())
{
// System.out.println(item.getId());
if (remove_from_toolbar.contains(item.getId()))
{ // Result of trial-and-error:
// * item.setVisible(false) has no effect
// * toolbar.remove(item) results in
// Error disposing widget for : org.eclipse.e4.ui.model.application.ui.menu.impl.ToolBarImpl
// java.lang.NullPointerException
// at org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer.cleanUpCopy(ToolBarManagerRenderer.java:554)
// at org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer.cleanUp(ToolBarManagerRenderer.java:534)
// at org.eclipse.e4.ui.workbench.renderers.swt.ToolBarManagerRenderer$4.widgetDisposed(ToolBarManagerRenderer.java:423
// * disposing the item without removing it from the toolbar "works" ?!
item.dispose();
}
}
toolbar.update(true);
patchMenu(window);
}
示例2: cleanupMenusAndCoolBar
import org.eclipse.jface.action.ICoolBarManager; //导入方法依赖的package包/类
protected void cleanupMenusAndCoolBar() {
IContributionItem[] mItems, mSubItems;
IMenuManager mm = getWindowConfigurer().getActionBarConfigurer().getMenuManager();
mItems = mm.getItems();
for (int i = 0; i < mItems.length; i++) {
if (mItems[i] instanceof MenuManager) {
mSubItems = ((MenuManager) mItems[i]).getItems();
for (int j = 0; j < mSubItems.length; j++) {
if (getItemsToRemove().keySet().contains(mItems[i].getId())) {
for (String fileItemToRemove : getItemsToRemove().get(mItems[i].getId()))
((MenuManager)mItems[i]).remove(fileItemToRemove);
}
}
}
}
if (getItemsToRemove().keySet().contains("file")) {
ICoolBarManager cbm = getWindowConfigurer().getActionBarConfigurer().getCoolBarManager();
for (String itemToRemove : getItemsToRemove().get("file")) {
for (IContributionItem item : cbm.getItems()) {
if (item instanceof ToolBarContributionItem)
((ToolBarContributionItem)item).getToolBarManager().remove(itemToRemove);
else
cbm.remove(itemToRemove);
}
}
cbm.update(true);
}
}