本文整理匯總了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;
}