use of org.eclipse.ui.menus.IMenuService in project translationstudio8 by heartsome.
the class ApplicationActionBarAdvisor method dispose.
/**
* 创建自定义的插件菜单 2012-03-07
* @return ;
*/
/*
* private MenuManager createAutoPluginMenu() { MenuManager menu = new MenuManager("asdfasd",
* "net.heartsome.cat.ts.ui.menu.plugin"); // menu = MenuManag
*
* // menu.appendToGroup(groupName, item) menu.add(helpSearchAction); return menu; }
*/
@Override
public void dispose() {
if (isDisposed) {
return;
}
isDisposed = true;
IMenuService menuService = (IMenuService) window.getService(IMenuService.class);
menuService.releaseContributions(coolbarPopupMenuManager);
coolbarPopupMenuManager.dispose();
super.dispose();
}
use of org.eclipse.ui.menus.IMenuService in project translationstudio8 by heartsome.
the class ApplicationActionBarAdvisor method fillCoolBar.
@Override
protected void fillCoolBar(ICoolBarManager coolBar) {
// Set up the context Menu
coolbarPopupMenuManager = new MenuManager();
coolbarPopupMenuManager.add(new ActionContributionItem(lockToolBarAction));
coolBar.setContextMenuManager(coolbarPopupMenuManager);
IMenuService menuService = (IMenuService) window.getService(IMenuService.class);
menuService.populateContributionManager(coolbarPopupMenuManager, "popup:windowCoolbarContextMenu");
coolBar.add(new GroupMarker("group.file"));
// File Group
// IToolBarManager fileToolBar = new ToolBarManager(coolBar.getStyle());
// fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.OPEN_EXT));
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
// // 为了使工具栏和菜单中的图片大小不一样,重新创建新建 Action
// newAction = ActionFactory.NEW_WIZARD_DROP_DOWN.create(window);
// register(newAction);
// ImageDescriptor newImage =
// net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_NEW_PROJECT);
// newAction.setImageDescriptor(newImage);
// // 解决在 Windows 下图片显示错误的问题
// newAction.setDisabledImageDescriptor(newImage);
// newAction.setToolTipText(Messages.getString("ts.ApplicationActionBarAdvisor.newAction"));
// fileToolBar.add(newAction);
// saveAction = ActionFactory.SAVE.create(window);
// register(saveAction);
// saveAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_SAVE));
// saveAction.setToolTipText("保存");
// fileToolBar.add(saveAction);
// undoAction = ActionFactory.UNDO.create(window);
// register(undoAction);
// undoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_UNDO));
// undoAction.setToolTipText("撤销");
// fileToolBar.add(undoAction);
//
// redoAction = ActionFactory.REDO.create(window);
// register(redoAction);
// redoAction.setImageDescriptor(net.heartsome.cat.ts.ui.Activator.getImageDescriptor(ImageConstant.TOOL_REDO));
// redoAction.setToolTipText("重做");
// fileToolBar.add(redoAction);
// fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
// fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// Add to the cool bar manager
// coolBar.add(new ToolBarContributionItem(fileToolBar, IWorkbenchActionConstants.TOOLBAR_FILE));
coolBar.add(new GroupMarker("group.new.menu"));
coolBar.add(new GroupMarker("group.undoredo"));
coolBar.add(new GroupMarker("group.copySource"));
coolBar.add(new GroupMarker("group.search"));
//createToolItem(coolBar);
coolBar.add(new GroupMarker("group.findreplace"));
coolBar.add(new GroupMarker("group.completeTranslation"));
coolBar.add(new GroupMarker("group.approve"));
coolBar.add(new GroupMarker("group.addTerm"));
coolBar.add(new GroupMarker("group.preview"));
coolBar.add(new GroupMarker("group.tagoperation"));
coolBar.add(new GroupMarker("group.sourceoperation"));
coolBar.add(new GroupMarker("group.deleteTrans"));
coolBar.add(new GroupMarker("group.changeLayout"));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_EDITOR));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));
// Help group
// IToolBarManager helpToolBar = new ToolBarManager(coolBar.getStyle());
// helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
// // 按照设计文档的要求,先注释 helpSearchAction
// // helpToolBar.add(helpSearchAction);
// // Add the group for applications to contribute
// helpToolBar.add(new GroupMarker("tagoperation"));
// helpToolBar.add(new GroupMarker("pretranslation"));
//
// // Add to the cool bar manager
// coolBar.add(new ToolBarContributionItem(helpToolBar, IWorkbenchActionConstants.TOOLBAR_HELP));
//coolBar.add(createToolItem(coolBar));
}
Aggregations