當前位置: 首頁>>代碼示例>>Java>>正文


Java MenuManager.add方法代碼示例

本文整理匯總了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 ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:22,代碼來源:ProtocolEditor.java

示例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()));
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:18,代碼來源:DebugDataViewer.java

示例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();
		}
	});

}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:21,代碼來源:CustomAboutDialog.java

示例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());
		}
	}

}
 
開發者ID:eclipse,項目名稱:n4js,代碼行數:15,代碼來源:N4JSNewWizardsActionGroup.java

示例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));
}
 
開發者ID:occiware,項目名稱:OCCI-Studio,代碼行數:21,代碼來源:PlatformEditor.java

示例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()));
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:14,代碼來源:DebugDataViewer.java

示例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;
}
 
開發者ID:capitalone,項目名稱:Hydrograph,代碼行數:7,代碼來源:DebugDataViewer.java


注:本文中的org.eclipse.jface.action.MenuManager.add方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。