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


Java IMenuListener類代碼示例

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


IMenuListener類屬於org.eclipse.jface.action包,在下文中一共展示了IMenuListener類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: contributeActions

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
@Override
protected void contributeActions() {
    final SourceFilesCheckinControl sourceFilesSubControl = getCheckinControl().getSourceFilesSubControl();

    sourceFilesSubControl.getContextMenu().addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            final String groupId = StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS;

            manager.appendToGroup(groupId, viewSubMenu);
            manager.appendToGroup(groupId, new Separator());
            manager.appendToGroup(groupId, compareSubMenu);
        }
    });

    (sourceFilesSubControl).getChangesTable().addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            if (viewAction.isEnabled()) {
                viewAction.run();
            }
        }
    });
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:25,代碼來源:ChangesetDetailsView.java

示例2: contributeActions

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
@Override
protected void contributeActions() {
    final SourceFilesCheckinControl sourceFilesSubControl = getCheckinControl().getSourceFilesSubControl();

    sourceFilesSubControl.getContextMenu().addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            final String groupId = StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS;

            manager.appendToGroup(groupId, viewSubMenu);
            manager.appendToGroup(groupId, new Separator());
            manager.appendToGroup(groupId, compareSubMenu);
        }
    });

    (sourceFilesSubControl).getChangesTable().addDoubleClickListener(new IDoubleClickListener() {
        @Override
        public void doubleClick(final DoubleClickEvent event) {
            if (viewAction.isEnabled()) {
                viewAction.run();
            } else if (viewUnmodifiedAction.isEnabled()) {
                viewUnmodifiedAction.run();
            }
        }
    });
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:27,代碼來源:ShelvesetDetailsView.java

示例3: contributeActions

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private void contributeActions() {
    contextMenu.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            manager.add(new Separator(StandardActionConstants.HOSTING_CONTROL_CONTRIBUTIONS));
            manager.add(new Separator(StandardActionConstants.PRIVATE_CONTRIBUTIONS));

            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, newNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, renameNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, deleteNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator());
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, moveUpNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, moveDownNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator());
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, demoteNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, promoteNodeAction);
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, new Separator());
            manager.appendToGroup(StandardActionConstants.PRIVATE_CONTRIBUTIONS, refreshAction);
        }
    });
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:22,代碼來源:CommonStructureControl.java

示例4: createPendingChangesTable

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private Composite createPendingChangesTable(final Composite parent) {
    int style = SWT.FULL_SELECTION | SWT.MULTI;
    if (options.isSourceFilesCheckboxes()) {
        style |= SWT.CHECK;
    }

    changesTable = new ChangesTable(parent, style);
    AutomationIDHelper.setWidgetID(changesTable, SOURCEFILES_TABLE_ID);

    changesTable.getContextMenu().addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillMenu(manager);
        }
    });

    setSelectionProvider(changesTable);
    setContextMenu(changesTable.getContextMenu());

    return changesTable;
}
 
開發者ID:Microsoft,項目名稱:team-explorer-everywhere,代碼行數:22,代碼來源:SourceFilesCheckinControl.java

示例5: createContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
/**
 * Creates the context menu. 
 */
private void createContextMenu() {
    // create menu manager
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager mgr) {
            fillContextMenu(mgr);
        }
    });
    
    // create the menu
    Menu menu = menuMgr.createContextMenu(getTreeViewer().getControl());
    getTreeViewer().getControl().setMenu(menu);
    
    //register menu for extensions
    //getSite().registerContextMenu(menuMgr, getTreeViewer());
}
 
開發者ID:eclipse,項目名稱:texlipse,代碼行數:21,代碼來源:TexOutlinePage.java

示例6: setupMenuListener

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
public void setupMenuListener(MenuManager menuMgr) {
	menuMgr.addMenuListener(new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager manager) {
			ISelection selection = viewer.getSelection();
			Object obj = ((IStructuredSelection) selection).getFirstElement();

			if (obj instanceof DisplayObject) {

				IElement element = ((DisplayObject) obj).getElement();
				if (element != null) {
					Set<BaseTraceability> path = element.getTraceability();
					if (path != null) {
						MenuUtils.setTraceToCodeMenu(manager, path, log);
					}
				}
			} else {
				System.out.println(obj.getClass().getSimpleName());
			}

		}
	});
}
 
開發者ID:aroog,項目名稱:code,代碼行數:24,代碼來源:ObjectSearchView.java

示例7: createPopupMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private void createPopupMenu() {
	removeHistoryItemAction = new RemoveHistoryItemAction();
	removeHistoryActionContributionItem = new ActionContributionItem(
			removeHistoryItemAction);

	contextMenuManager = new MenuManager();
	contextMenuManager.setRemoveAllWhenShown(true);
	contextMenuManager.addMenuListener(new IMenuListener() {
		
		public void menuAboutToShow(IMenuManager manager) {
			fillContextMenu(manager);
		}
	});

	final Table table = list.getTable();
	Menu menu= contextMenuManager.createContextMenu(table);
	table.setMenu(menu);
}
 
開發者ID:tlaplus,項目名稱:tlaplus,代碼行數:19,代碼來源:FilteredItemsSelectionDialog.java

示例8: createContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
/**
 * Contextual menu
 */
private void createContextMenu() {
  // Create menu manager.
  MenuManager menuMgr = new MenuManager();
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    public void menuAboutToShow(IMenuManager mgr) {
      fillContextMenu(mgr);
    }
  });

  // Create menu.
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);

  // Register menu for extension.
  getSite().registerContextMenu(menuMgr, viewer);
}
 
開發者ID:Nextzero,項目名稱:hadoop-2.6.0-cdh5.4.3,代碼行數:21,代碼來源:ServerView.java

示例9: addRefactorSubmenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private void addRefactorSubmenu(IMenuManager menu) {
	MenuManager refactorSubmenu = new MenuManager(RefactoringMessages.RefactorMenu_label, MENU_ID);
	// refactorSubmenu.setActionDefinitionId(QUICK_MENU_ID);
	if (fEditor != null) {
		// final ITypeRoot element= getEditorInput();
		// if (element != null && ActionUtil.isOnBuildPath(element)) {
		refactorSubmenu.addMenuListener(new IMenuListener() {
			@Override
			public void menuAboutToShow(IMenuManager manager) {
				refactorMenuShown(manager);
			}
		});
		refactorSubmenu.add(fNoActionAvailable);
		menu.appendToGroup(fGroupName, refactorSubmenu);
		// }
	} else {
		ISelection selection = fSelectionProvider.getSelection();
		for (Iterator<SelectionDispatchAction> iter = fActions.iterator(); iter.hasNext();) {
			iter.next().update(selection);
		}
		if (fillRefactorMenu(refactorSubmenu) > 0)
			menu.appendToGroup(fGroupName, refactorSubmenu);
	}
}
 
開發者ID:angelozerr,項目名稱:typescript.java,代碼行數:25,代碼來源:RefactorActionGroup.java

示例10: createContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
/**
 * Creates a pop-up menu on the given control
 * 
 * @param menuControl
 *            the control with which the pop-up menu will be associated
 */
private void createContextMenu(Viewer viewer) {
	Control menuControl = viewer.getControl();
	MenuManager menuMgr = new MenuManager("#PopUp"); //$NON-NLS-1$
	menuMgr.setRemoveAllWhenShown(true);
	menuMgr.addMenuListener(new IMenuListener() {
		@Override
		public void menuAboutToShow(IMenuManager mgr) {
			fillContextMenu(mgr);
		}
	});
	Menu menu = menuMgr.createContextMenu(menuControl);
	menuControl.setMenu(menu);

	// register the context menu such that other plugins may contribute to
	// it
	getSite().registerContextMenu(menuMgr, viewer);
}
 
開發者ID:angelozerr,項目名稱:jsbuild-eclipse,代碼行數:24,代碼來源:JSBuildFileView.java

示例11: hookContextMenu

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

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

        }
);
        org.eclipse.swt.widgets.Menu menu = menuMgr.createContextMenu(viewer.getControl());
        viewer.getControl().setMenu(menu);
        getSite().registerContextMenu(menuMgr, viewer);
    }
 
開發者ID:qxo,項目名稱:eclipse-code-lines-plugin,代碼行數:18,代碼來源:LinesView.java

示例12: setupHierarchyMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private void setupHierarchyMenu(final TreeViewer viewer) {
  MenuManager menuMgr = new MenuManager();

  Menu menu = menuMgr.createContextMenu(viewer.getControl());

  menuMgr.addMenuListener(new IMenuListener() {

    @Override
    public void menuAboutToShow(IMenuManager manager) {
      ISelection selection = viewer.getSelection();
      List<?> choices = Selections.getObjects(selection);
      if (choices.isEmpty()) {
        return;
      }
      if (choices.size() > 1) {
        addMultiActions(manager);
        return;
      }

      Object menuElement = Selections.getFirstObject(selection);
      addItemActions(manager, menuElement);
    }});

  menuMgr.setRemoveAllWhenShown(true);
  viewer.getControl().setMenu(menu);
}
 
開發者ID:google,項目名稱:depan,代碼行數:27,代碼來源:GraphNodeViewer.java

示例13: createContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
/** Add context menu to axes_table */
private void createContextMenu()
{
    final MenuManager menu = new MenuManager();
    menu.setRemoveAllWhenShown(true);
    menu.addMenuListener(new IMenuListener()
    {
        @Override
        public void menuAboutToShow(IMenuManager manager)
        {
            menu.add(new AddAxisAction(operations_manager, model));
            if (!axes_table.getSelection().isEmpty())
                menu.add(new DeleteAxesAction(operations_manager, axes_table, model));
            if (model.getEmptyAxis() != null)
                menu.add(new RemoveUnusedAxesAction(operations_manager, model));
            menu.add(new Separator());
            menu.add(new GroupMarker(IWorkbenchActionConstants.MB_ADDITIONS));
        }
    });
    final Table table = axes_table.getTable();
    table.setMenu(menu.createContextMenu(table));
}
 
開發者ID:kasemir,項目名稱:org.csstudio.display.builder,代碼行數:23,代碼來源:AxesTableHandler.java

示例14: createContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
private void createContextMenu() {
  MenuManager menuMgr = new MenuManager("#PopupMenu");
  menuMgr.setRemoveAllWhenShown(true);
  menuMgr.addMenuListener(new IMenuListener() {
    @Override
    public void menuAboutToShow(IMenuManager manager) {
      populateBrowserActions(launchConfiguration, manager);
      manager.add(new Separator());

      manager.add(new Action("&Copy") {
        @Override
        public void run() {
          copySelectionToClipboard();
        }
      });
    }
  });
  Menu menu = menuMgr.createContextMenu(viewer.getControl());
  viewer.getControl().setMenu(menu);
}
 
開發者ID:gwt-plugins,項目名稱:gwt-eclipse-plugin,代碼行數:21,代碼來源:LaunchConfigurationContent.java

示例15: hookContextMenu

import org.eclipse.jface.action.IMenuListener; //導入依賴的package包/類
/***********************************************************************
 * Select context menu
 **********************************************************************/
private void hookContextMenu()
{
	MenuManager menuMgr = new MenuManager("#PopupMenu");
	menuMgr.setRemoveAllWhenShown(true);
	menuMgr.addMenuListener(new IMenuListener()
	{
		public void menuAboutToShow(IMenuManager manager)
		{
			NavigationView.this.fillContextMenu(manager);
		}
	});
	Menu menu = menuMgr.createContextMenu(m_procTree.getControl());
	m_procTree.getControl().setMenu(menu);
	getSite().registerContextMenu(menuMgr, m_procTree);
}
 
開發者ID:Spacecraft-Code,項目名稱:SPELL,代碼行數:19,代碼來源:NavigationView.java


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