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


Java MenuManager.createContextMenu方法代碼示例

本文整理匯總了Java中org.eclipse.jface.action.MenuManager.createContextMenu方法的典型用法代碼示例。如果您正苦於以下問題:Java MenuManager.createContextMenu方法的具體用法?Java MenuManager.createContextMenu怎麽用?Java MenuManager.createContextMenu使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在org.eclipse.jface.action.MenuManager的用法示例。


在下文中一共展示了MenuManager.createContextMenu方法的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的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,代碼來源:RecipeEditor.java

示例2: 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 NOT
 */
protected void createContextMenuFor ( final StructuredViewer viewer )
{
    final MenuManager contextMenu = new MenuManager ( "#PopUp" ); //$NON-NLS-1$
    contextMenu.add ( new Separator ( "additions" ) ); //$NON-NLS-1$
    contextMenu.setRemoveAllWhenShown ( true );
    contextMenu.addMenuListener ( this );
    final Menu menu = contextMenu.createContextMenu ( viewer.getControl () );
    viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( contextMenu, new UnwrappingSelectionProvider ( viewer ) );

    final int dndOperations = DND.DROP_COPY | DND.DROP_MOVE | DND.DROP_LINK;
    final Transfer[] transfers = new Transfer[] {
            LocalTransfer.getInstance (),
            LocalSelectionTransfer.getTransfer (),
            FileTransfer.getInstance (),
            ItemTransfer.getInstance ()
    };
    viewer.addDragSupport ( dndOperations, transfers, new ViewerDragAdapter ( viewer ) );
    viewer.addDropSupport ( dndOperations, transfers, new DropAdapterExtension ( this.editingDomain, viewer ) );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:29,代碼來源:ChartEditor.java

示例3: 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,代碼來源:InfrastructureEditor.java

示例4: hookContextMenu

import org.eclipse.jface.action.MenuManager; //導入方法依賴的package包/類
private void hookContextMenu() {
	MenuManager menuMgr = new MenuManager("#PopupMenu");
	menuMgr.setRemoveAllWhenShown(true);
	menuMgr.addMenuListener(new IMenuListener() {
		public void menuAboutToShow(IMenuManager manager) {
			PerformanceView.this.fillContextMenu(manager);
		}
	});
	Menu menu = menuMgr.createContextMenu(viewer.getControl());
	viewer.getControl().setMenu(menu);
	getSite().registerContextMenu(menuMgr, viewer);
}
 
開發者ID:gw4e,項目名稱:gw4e.project,代碼行數:13,代碼來源:PerformanceView.java

示例5: hookContextMenu

import org.eclipse.jface.action.MenuManager; //導入方法依賴的package包/類
private void hookContextMenu() {
    MenuManager menuMgr = new MenuManager("#PopupMenu");
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        public void menuAboutToShow(IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    Menu menu = menuMgr.createContextMenu(_TreeViewer.getControl());
    _TreeViewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, _TreeViewer);
}
 
開發者ID:baloise,項目名稱:eZooKeeper,代碼行數:15,代碼來源:JmxExplorerView.java

示例6: registerContextMenu

import org.eclipse.jface.action.MenuManager; //導入方法依賴的package包/類
private void registerContextMenu() {
  final MenuManager contextMenu = new MenuManager();
  contextMenu.setRemoveAllWhenShown(true);
  this.getSite().registerContextMenu(contextMenu, ContextualView.treeViewer);
  // Add in the entries for all markers views if this has a different if
  if (!this.getSite().getId().equals(ContextualView.MARKERS_ID)) {
    this.getSite().registerContextMenu(ContextualView.MARKERS_ID, contextMenu, ContextualView.treeViewer);
  }
  final Control control = ContextualView.treeViewer.getControl();
  final Menu menu = contextMenu.createContextMenu(control);
  control.setMenu(menu);
}
 
開發者ID:ModelWriter,項目名稱:Tarski,代碼行數:13,代碼來源:ContextualView.java

示例7: hookContextMenu

import org.eclipse.jface.action.MenuManager; //導入方法依賴的package包/類
private void hookContextMenu ()
{
    final MenuManager menuMgr = new MenuManager ( "#PopupMenu", VIEW_ID );
    menuMgr.setRemoveAllWhenShown ( true );
    menuMgr.addMenuListener ( new IMenuListener () {
        @Override
        public void menuAboutToShow ( final IMenuManager manager )
        {
            fillContextMenu ( manager );
        }
    } );
    final Menu menu = menuMgr.createContextMenu ( this.viewer.getControl () );
    this.viewer.getControl ().setMenu ( menu );
    getSite ().registerContextMenu ( menuMgr, this.viewer );
}
 
開發者ID:eclipse,項目名稱:neoscada,代碼行數:16,代碼來源:EventQueryView.java

示例8: createPartControl

import org.eclipse.jface.action.MenuManager; //導入方法依賴的package包/類
@Override
public void createPartControl(Composite parent) {

	FillLayout fillLayout = new FillLayout(SWT.VERTICAL);
	fillLayout.marginHeight = 5;
	fillLayout.marginWidth = 5;
	parent.setLayout(fillLayout);

	// main container
	container = new Composite(parent, SWT.BORDER);
	container.setLayout(new FillLayout());

	// create container for stack trace data
	Composite stacktraceDataContainer = new Composite(parent, SWT.BORDER);

	FormLayout formLayout = new FormLayout();
	formLayout.marginHeight = 5;
	formLayout.marginWidth = 5;
	formLayout.spacing = 5;
	stacktraceDataContainer.setLayout(formLayout);

	Composite stackLabelContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackLabelContainer.setLayout(new GridLayout());

	FormData stackLabelFormData = new FormData();
	stackLabelFormData.top = new FormAttachment(0);
	stackLabelFormData.left = new FormAttachment(0);
	stackLabelFormData.right = new FormAttachment(100);
	stackLabelFormData.bottom = new FormAttachment(20);
	stackLabelContainer.setLayoutData(stackLabelFormData);

	Composite stackTraceContainer = new Composite(stacktraceDataContainer, SWT.NO_SCROLL | SWT.SHADOW_NONE);
	stackTraceContainer.setLayout(new FillLayout());

	FormData stackTraceFormData = new FormData();
	stackTraceFormData.top = new FormAttachment(stackLabelContainer);
	stackTraceFormData.left = new FormAttachment(0);
	stackTraceFormData.right = new FormAttachment(100);
	stackTraceFormData.bottom = new FormAttachment(100);
	stackTraceContainer.setLayoutData(stackTraceFormData);

	// Create viewer for test tree in main container
	testTreeViewer = new TreeViewer(container);
	testTreeViewer.setContentProvider(new XpectContentProvider());
	testTreeViewer.setLabelProvider(new XpectLabelProvider(this.testsExecutionStatus));
	testTreeViewer.setInput(null);

	// create stack trace label
	stacktraceLabel = new Label(stackLabelContainer, SWT.SHADOW_OUT);
	FontData fontData = stacktraceLabel.getFont().getFontData()[0];
	Display display = Display.getCurrent();
	// may be null if outside the UI thread
	if (display == null)
		display = Display.getDefault();
	Font font = new Font(display, new FontData(fontData.getName(), fontData
			.getHeight(), SWT.BOLD));
	// Make stack trace label bold
	stacktraceLabel.setFont(font);

	stacktraceLabel.setText(NO_TRACE_MSG);

	// create stack trace console
	MessageConsole messageConsole = new MessageConsole("trace", null);
	stacktraceConsole = new TraceConsole(messageConsole);
	stacktraceConsoleViewer = new TextConsoleViewer(stackTraceContainer, messageConsole);

	// context menu
	getSite().setSelectionProvider(testTreeViewer);
	MenuManager contextMenu = new MenuManager();
	contextMenu.setRemoveAllWhenShown(true);
	getSite().registerContextMenu(contextMenu, testTreeViewer);
	Control control = testTreeViewer.getControl();
	Menu menu = contextMenu.createContextMenu(control);
	control.setMenu(menu);
	activateContext();

	createSelectionActions();

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


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