本文整理汇总了Java中org.eclipse.ui.menus.IMenuService.populateContributionManager方法的典型用法代码示例。如果您正苦于以下问题:Java IMenuService.populateContributionManager方法的具体用法?Java IMenuService.populateContributionManager怎么用?Java IMenuService.populateContributionManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.ui.menus.IMenuService
的用法示例。
在下文中一共展示了IMenuService.populateContributionManager方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: run
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
/**
* The default behavior is to show the same content as clicking the dropdown arrow. Subclass could override.
*
* @param parent
* the parent toolbar
*/
protected void run(ToolBar parent)
{
if (!isEnabled())
{
return;
}
Point toolbarLocation = parent.getLocation();
toolbarLocation = parent.getParent().toDisplay(toolbarLocation.x, toolbarLocation.y);
Point toolbarSize = parent.getSize();
MenuManager menuManager = new MenuManager(null, getMenuId());
IMenuService menuService = (IMenuService) partSite.getService(IMenuService.class);
menuService.populateContributionManager(menuManager, MenuUtil.menuUri(menuManager.getId()));
fillMenu(menuManager);
Menu menu = menuManager.createContextMenu(parent);
menu.setLocation(toolbarLocation.x, toolbarLocation.y + toolbarSize.y + 2);
menu.setVisible(true);
}
示例2: fillPopupMenu
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
@Override
public void fillPopupMenu(IMenuManager manager, SchemaViewer viewer) {
for (String section : ORDERED_SECTIONS) {
manager.add(new Separator(section));
}
IMenuService service = serviceProvider.getMenuService();
service.populateContributionManager((ContributionManager) manager, getPopupMenuId());
}
示例3: createPartControl
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
/**
* This is a callback that will allow us to create the viewer and initialize it.
*
* @param parent
* The parent ui element to create this editor in.
*/
public void createPartControl(Composite parent) {
toolkit = new FormToolkit(parent.getDisplay());
form = toolkit.createForm(parent);
form.setText("SPLevo Refinement Browser");
toolkit.decorateFormHeading(form);
form.getMenuManager().add(new ApplyRefinementsAction(this, "Apply Refinements"));
form.getMenuManager().add(new ApplySelectedRefinementsAction(this, "Apply Selected Refinements"));
form.getBody().setLayout(new FillLayout(SWT.HORIZONTAL));
SashForm sashForm = new SashForm(form.getBody(), SWT.FILL);
sashForm.setSashWidth(1);
sashForm.setBackground(SWTResourceManager.getColor(SWT.COLOR_GRAY));
toolkit.adapt(sashForm);
toolkit.paintBordersFor(sashForm);
createRefinementListView(sashForm);
createRefinementDetails(sashForm);
// The listener must be added after the two connected required widgets have been created
refinementListView.addSelectionChangedListener(new RefinementSelectionListener(detailsView));
refinementListView.addSelectionChangedListener(new RefinementInfoSelectionListener(detailsView));
IActionBars actionBars = getEditorSite().getActionBars();
refinementListView.addSelectionChangedListener(new RefinementActionBarListener(actionBars));
sashForm.setWeights(new int[] { 2, 8 });
ToolBarManager manager = (ToolBarManager) form.getToolBarManager();
manager.add(new ApplyRefinementsAction(this, "Apply Refinements"));
manager.add(new ApplySelectedRefinementsAction(this, "Apply Selected Refinements"));
manager.add(new ToggleVisualizationAction(this, getEnableVisualizationDefault()));
manager.add(new CancelAction(this, "Cancel and close"));
IMenuService menuService = (IMenuService) getSite().getService(IMenuService.class);
menuService.populateContributionManager(manager, "popup:formsToolBar");
manager.update(true);
initContextMenu();
initToolTips(refinementListView);
}
示例4: contributeToMenu
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
public void contributeToMenu( IMenuManager menubar )
{
super.contributeToMenu( menubar );
updateEditMenu( menubar );
// Insert Menu
MenuManager insertMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.insert" ), M_INSERT ); //$NON-NLS-1$
createInsertMenu( insertMenu );
insertMenu.addMenuListener( new IMenuListener( ) {
public void menuAboutToShow( IMenuManager manager )
{
manager.removeAll( );
insertElementActions = null;
createInsertMenu( manager );
}
} );
// insertMenu.add( getAction( ImportLibraryAction.ID ) );
menubar.insertAfter( IWorkbenchActionConstants.M_EDIT, insertMenu );
// Element Menu
MenuManager elementMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.element" ), M_ELEMENT ); //$NON-NLS-1$
contributeElementMenu( elementMenu );
menubar.insertAfter( M_INSERT, elementMenu );
// Data Menu
MenuManager dataMenu = new MenuManager( Messages.getString( "DesignerActionBarContributor.menu.data" ), M_DATA ); //$NON-NLS-1$
// the data actions are now registered through eclipse menu extensions
IMenuService menuService = (IMenuService) PlatformUI.getWorkbench( )
.getService( IMenuService.class );
menuService.populateContributionManager( dataMenu, "menu:birtData" ); //$NON-NLS-1$
menubar.insertAfter( M_ELEMENT, dataMenu );
menubar.update( );
}
示例5: fillPopupMenu
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
protected void fillPopupMenu(IMenuManager manager) {
IMenuService service = (IMenuService) editor.getServiceProvider().getMenuService();
service.populateContributionManager((ContributionManager) manager, POPUP_MENU_ID);
}
示例6: populateToolBar
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
protected void populateToolBar(ToolBarManager manager, String toolBarId) {
IMenuService service = serviceProvider.getMenuService();
service.populateContributionManager(manager, toolBarId);
}
示例7: fillCoolBar
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
/**
* Fills the coolbar with the workbench actions.
*/
protected void fillCoolBar(ICoolBarManager coolBar)
{
IActionBarConfigurer2 actionBarConfigurer =
(IActionBarConfigurer2) getActionBarConfigurer();
// Set up the context Menu
coolbarPopupMenuManager = new MenuManager();
coolBar.setContextMenuManager(coolbarPopupMenuManager);
IMenuService menuService =
(IMenuService) window.getService(IMenuService.class);
menuService.populateContributionManager(coolbarPopupMenuManager,
"popup:windowCoolbarContextMenu"); //$NON-NLS-1$
// File Group
IToolBarManager fileToolBar = actionBarConfigurer.createToolBarManager();
fileToolBar.add(new Separator(IWorkbenchActionConstants.NEW_GROUP));
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.NEW_EXT));
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_GROUP));
fileToolBar.add(saveAction);
fileToolBar.add(saveAllAction);
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.SAVE_EXT));
fileToolBar.add(getPrintItem());
fileToolBar.add(new GroupMarker(IWorkbenchActionConstants.PRINT_EXT));
fileToolBar.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
// Add to the cool bar manager
coolBar.add(actionBarConfigurer.createToolBarContributionItem(fileToolBar,
IWorkbenchActionConstants.TOOLBAR_FILE));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
coolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_HELP));
// Help group
IToolBarManager helpToolBar = actionBarConfigurer.createToolBarManager();
helpToolBar.add(new Separator(IWorkbenchActionConstants.GROUP_HELP));
// helpToolBar.add(searchComboItem);
// Add the group for applications to contribute
helpToolBar.add(new GroupMarker(IWorkbenchActionConstants.GROUP_APP));
// Add to the cool bar manager
coolBar.add(actionBarConfigurer.createToolBarContributionItem(helpToolBar,
IWorkbenchActionConstants.TOOLBAR_HELP));
}
示例8: fillCoolBar
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
@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"));
coolBar.add(new GroupMarker("group.search"));
createToolItem(coolBar);
coolBar.add(new GroupMarker("group.new.menu"));
coolBar.add(new GroupMarker("group.undoredo"));
coolBar.add(new GroupMarker("group.tu"));
coolBar.add(new GroupMarker("group.tmxtool"));
coolBar.add(new GroupMarker("group.tmxclear"));
coolBar.add(new GroupMarker("group.copySource"));
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));
//未提供 24 位图标,屏蔽工具栏。
// IToolBarManager toolbar = new ToolBarManager(coolBar.getStyle());
// coolBar.add(new ToolBarContributionItem(toolbar, "help"));
// toolbar.add(helpAction);
}
示例9: fillCoolBar
import org.eclipse.ui.menus.IMenuService; //导入方法依赖的package包/类
@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"));
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.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));
}