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