本文整理汇总了Java中org.eclipse.jface.action.MenuManager.add方法的典型用法代码示例。如果您正苦于以下问题:Java MenuManager.add方法的具体用法?Java MenuManager.add怎么用?Java MenuManager.add使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.eclipse.jface.action.MenuManager
的用法示例。
在下文中一共展示了MenuManager.add方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: createContextMenuFor
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
/**
* This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createContextMenuFor ( StructuredViewer viewer )
{
MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
contextMenu.setRemoveAllWhenShown ( true );
contextMenu.addMenuListener ( this );
Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
viewer.getControl ().setMenu ( menu );
getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance (), LocalSelectionTransfer.getTransfer (), FileTransfer.getInstance () };
viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
viewer.addDropSupport ( dndOperations, transfers, new EditingDomainViewerDropAdapter ( editingDomain, viewer ) );
}
示例2: createViewMenu
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
private void createViewMenu(MenuManager menuManager) {
MenuManager viewMenu = createMenu(menuManager, MenuConstants.VIEW);
menuManager.add(viewMenu);
viewMenu.setVisible(true);
if (actionFactory == null) {
actionFactory = new ActionFactory(this);
}
viewMenu.add(actionFactory.getAction(GridViewAction.class.getName()));
viewMenu.add(actionFactory.getAction(FormattedViewAction.class.getName()));
viewMenu.add(actionFactory.getAction(UnformattedViewAction.class.getName()));
viewMenu.add(new Separator());
viewMenu.add(actionFactory.getAction(ReloadAction.class.getName()));
viewDataPreferencesVO = getViewDataPreferencesFromPreferenceFile();
viewMenu.add(actionFactory.getAction(PreferencesAction.class.getName()));
}
示例3: createTextMenu
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
/**
* Create the context menu for the text widget.
*
* @since 3.4
*/
private void createTextMenu() {
final MenuManager textManager = new MenuManager();
textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
null, IWorkbenchCommandConstants.EDIT_COPY, CommandContributionItem.STYLE_PUSH)));
textManager.add(new CommandContributionItem(new CommandContributionItemParameter(PlatformUI.getWorkbench(),
null, IWorkbenchCommandConstants.EDIT_SELECT_ALL, CommandContributionItem.STYLE_PUSH)));
text.setMenu(textManager.createContextMenu(text));
text.addDisposeListener(new DisposeListener() {
public void widgetDisposed(DisposeEvent e) {
textManager.dispose();
}
});
}
示例4: fillContextMenu
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
@Override
public void fillContextMenu(final IMenuManager menu) {
super.fillContextMenu(menu);
final ISelection selection = getContext().getSelection();
if (selection instanceof IStructuredSelection) {
if (canEnable((IStructuredSelection) selection)) {
final MenuManager newMenu = new MenuManager("Ne&w");
menu.appendToGroup(IContextMenuConstants.GROUP_NEW, newMenu);
newMenu.add(getNewWizardMenu());
}
}
}
示例5: createContextMenuFor
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
/**
* This creates a context menu for the viewer and adds a listener as well registering the menu for extension.
* <!-- begin-user-doc -->
* <!-- end-user-doc -->
* @generated
*/
protected void createContextMenuFor(StructuredViewer viewer) {
MenuManager contextMenu = new MenuManager("#PopUp");
contextMenu.add(new Separator("additions"));
contextMenu.setRemoveAllWhenShown(true);
contextMenu.addMenuListener(this);
Menu menu= contextMenu.createContextMenu(viewer.getControl());
viewer.getControl().setMenu(menu);
getSite().registerContextMenu(contextMenu, new UnwrappingSelectionProvider(viewer));
int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
Transfer[] transfers = new Transfer[] { LocalTransfer.getInstance(), LocalSelectionTransfer.getTransfer(), FileTransfer.getInstance() };
viewer.addDragSupport(dndOperations, transfers, new ViewerDragAdapter(viewer));
viewer.addDropSupport(dndOperations, transfers, new EditingDomainViewerDropAdapter(editingDomain, viewer));
}
示例6: createDataMenu
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
private void createDataMenu(MenuManager menuManager) {
MenuManager dataMenu = createMenu(menuManager, MenuConstants.Data);
menuManager.add(dataMenu);
dataMenu.setVisible(true);
if (actionFactory == null) {
actionFactory = new ActionFactory(this);
}
dataMenu.add(actionFactory.getAction(ResetSortAction.class.getName()));
dataMenu.add(actionFactory.getAction(FilterAction.class.getName()));
dataMenu.add(actionFactory.getAction(ClearFilterAction.class.getName()));
}
示例7: createMenu
import org.eclipse.jface.action.MenuManager; //导入方法依赖的package包/类
private MenuManager createMenu(MenuManager menuManager, String menuName) {
MenuManager menu = new MenuManager(menuName);
menuManager.add(menu);
menuManager.setVisible(true);
return menu;
}