Java 类org.eclipse.jface.action.IMenuListener 实例源码

项目:team-explorer-everywhere    文件:ChangesetDetailsView.java   
@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();
            }
        }
    });
}
项目:team-explorer-everywhere    文件:ShelvesetDetailsView.java   
@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();
            }
        }
    });
}
项目:team-explorer-everywhere    文件:CommonStructureControl.java   
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);
        }
    });
}
项目:team-explorer-everywhere    文件:SourceFilesCheckinControl.java   
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;
}
项目:texlipse    文件:TexOutlinePage.java   
/**
 * 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());
}
项目:code    文件:ObjectSearchView.java   
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());
            }

        }
    });
}
项目:tlaplus    文件:FilteredItemsSelectionDialog.java   
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);
}
项目:hadoop-2.6.0-cdh5.4.3    文件:ServerView.java   
/**
 * 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);
}
项目:hadoop-EAR    文件:ServerView.java   
/**
 * 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);
}
项目:typescript.java    文件:RefactorActionGroup.java   
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);
    }
}
项目:jsbuild-eclipse    文件:JSBuildFileView.java   
/**
 * 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);
}
项目:eclipse-code-lines-plugin    文件:LinesView.java   
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);
    }
项目:depan    文件:GraphNodeViewer.java   
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);
}
项目:org.csstudio.display.builder    文件:AxesTableHandler.java   
/** 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));
}
项目:gwt-eclipse-plugin    文件:LaunchConfigurationContent.java   
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);
}
项目:SPELL    文件:NavigationView.java   
/***********************************************************************
 * 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);
}
项目:PDFReporter-Studio    文件:RepositoryView.java   
private void createContextMenu() {
    // Create menu manager.
    MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager mgr) {
            fillMenu(mgr, fillContextMenu());
        }
    });

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

    // Register menu for extension.
    getSite().registerContextMenu(menuMgr, treeViewer);
}
项目:APICloud-Studio    文件:BundleView.java   
/**
 * hookContextMenu
 */
private void hookContextMenu()
{
    MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$

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

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

    // Register menu for extension.
    getSite().registerContextMenu(menuMgr, treeViewer);
}
项目:APICloud-Studio    文件:IndexView.java   
/**
 * hookContextMenu
 */
private void hookContextMenu()
{
    MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$

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

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

    // Register menu for extension.
    getSite().registerContextMenu(menuMgr, treeViewer);
}
项目:mytourbook    文件:MapBookmarkView.java   
/**
 * create the views context menu
 */
private void createUI_20_ContextMenu() {

    final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    final Table table = (Table) _bookmarkViewer.getControl();
    final Menu tableContextMenu = menuMgr.createContextMenu(table);

    _columnManager.createHeaderContextMenu(table, tableContextMenu);
}
项目:mytourbook    文件:TourPhotoLinkView.java   
/**
 * create the views context menu
 */
private void createContextMenu() {

    final MenuManager menuMgr = new MenuManager();

    menuMgr.setRemoveAllWhenShown(true);

    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager menuMgr2) {
            fillContextMenu(menuMgr2);
        }
    });

    final Table table = _tourViewer.getTable();
    final Menu tableContextMenu = menuMgr.createContextMenu(table);

    table.setMenu(tableContextMenu);

    _columnManager.createHeaderContextMenu(table, tableContextMenu);
}
项目:mytourbook    文件:TourWaypointView.java   
/**
 * create the views context menu
 */
private void createContextMenu() {

    final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    final Control viewerControl = _wpViewer.getControl();
    final Menu menu = menuMgr.createContextMenu(viewerControl);
    viewerControl.setMenu(menu);

    getSite().registerContextMenu(menuMgr, _wpViewer);
}
项目:mytourbook    文件:TourMarkerView.java   
/**
 * create the views context menu
 */
private void createUI_20_ContextMenu() {

    final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    final Table table = (Table) _markerViewer.getControl();
    final Menu tableContextMenu = menuMgr.createContextMenu(table);

    _columnManager.createHeaderContextMenu(table, tableContextMenu);
}
项目:mytourbook    文件:TourMarkerAllView.java   
/**
 * create the views context menu
 */
private void createUI_20_ContextMenu() {

    final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    final Table table = (Table) _markerViewer.getControl();
    final Menu tableContextMenu = menuMgr.createContextMenu(table);

    _columnManager.createHeaderContextMenu(table, tableContextMenu);
}
项目:mytourbook    文件:TourDataEditorView.java   
private void createUI_12_SliceViewerContextMenu(final Table table) {

        final MenuManager menuMgr = new MenuManager();

        menuMgr.setRemoveAllWhenShown(true);
        menuMgr.addMenuListener(new IMenuListener() {
            @Override
            public void menuAboutToShow(final IMenuManager manager) {
                fillSliceContextMenu(manager);
            }
        });

        final Menu tableContextMenu = menuMgr.createContextMenu(table);

        _sliceColumnManager.createHeaderContextMenu(table, tableContextMenu);
    }
项目:mytourbook    文件:PrefPageMap3Color.java   
/**
     * create the views context menu
     */
    private void createContextMenu() {

        final MenuManager menuMgr = new MenuManager();

        menuMgr.setRemoveAllWhenShown(true);

        menuMgr.addMenuListener(new IMenuListener() {
            @Override
            public void menuAboutToShow(final IMenuManager menuMgr2) {
//              fillContextMenu(menuMgr2);
            }
        });

        final Tree tree = _colorProfileViewer.getTree();
        final Menu treeContextMenu = menuMgr.createContextMenu(tree);

        tree.setMenu(treeContextMenu);

        _columnManager.createHeaderContextMenu(tree, treeContextMenu);
    }
项目:mytourbook    文件:GalleryMT20.java   
/**
 * Create context menu for the gallery
 */
private void createContextMenu() {

    _contextMenuMgr = new MenuManager();

    _contextMenuMgr.setRemoveAllWhenShown(true);

    _contextMenuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager menuMgr) {
            fillContextMenu(menuMgr);
        }
    });

    setMenu(_contextMenuMgr.createContextMenu(this));
}
项目:mytourbook    文件:PicDirFolder.java   
/**
 * create the views context menu
 */
private void createContextMenu() {

    final MenuManager menuMgr = new MenuManager();
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            fillContextMenu(manager);
        }
    });

    final Tree tree = _folderViewer.getTree();
    final Menu contextMenu = menuMgr.createContextMenu(tree);

    tree.setMenu(contextMenu);

    _picDirView.registerContextMenu(MENU_ID_PIC_DIR_VIEW_IN_FOLDER, menuMgr);
}
项目:plugindependencies    文件:PluginTreeView.java   
private void contributeToActionBars() {
    IActionBars bars = getViewSite().getActionBars();
    fillLocalToolBar(bars.getToolBarManager());

    IMenuManager dropDownMenu = bars.getMenuManager();
    dropDownMenu.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager manager) {
            fillTargetMenu(manager);
        }
    });
    dropDownMenu.add(showErrors);
    dropDownMenu.add(showConsole);
    dropDownMenu.add(hideWorkspacePlugins);
    dropDownMenu.add(loadTarget);
    dropDownMenu.add(reloadTargets);
}
项目:OpenSPIFe    文件:PlanAdvisorPage.java   
private void createTreeContextMenu(Tree tree) {
    // Create menu manager.
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager mgr) {
            fillContextMenu(mgr);
        }
    });
    // Create menu.
    Menu menu = menuManager.createContextMenu(tree);
    tree.setMenu(menu);
    // Register menu for extension.
    getSite().registerContextMenu(PLAN_ADVISOR_TREE_CONTEXT_MENU_ID, menuManager, viewer);
}
项目:OpenSPIFe    文件:WidgetUtils.java   
/**
 * Convenience method for creating a context menu.  Will log errors from
 * the menu listener for easier debugging.
 * 
 * @param control
 * @param listener
 */
public static final MenuManager createContextMenu(Control control, final IMenuListener listener) {
    // Create menu manager.
    MenuManager menuManager = new MenuManager();
    menuManager.setRemoveAllWhenShown(true);
    menuManager.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(IMenuManager mgr) {
            try {
                listener.menuAboutToShow(mgr);
            } catch (RuntimeException e) {
                LogUtil.error("menuAboutToShow", e);
                throw e;
            }
        }
    });
    // Create menu.
    Menu menu = menuManager.createContextMenu(control);
    control.setMenu(menu);
    return menuManager;
}
项目:Eclipse-Postfix-Code-Completion    文件:CustomFiltersActionGroup.java   
/**
 * Fills the given view menu with the entries managed by the
 * group.
 *
 * @param viewMenu the menu to fill
 */
public void fillViewMenu(IMenuManager viewMenu) {
    /*
     * Don't change the separator group name.
     * Using this name ensures that other filters
     * get contributed to the same group.
     */
    viewMenu.add(new Separator("filters")); //$NON-NLS-1$
    viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME));
    viewMenu.add(new ShowFilterDialogAction());

    fMenuManager= viewMenu;
    fMenuListener= new IMenuListener() {
        public void menuAboutToShow(IMenuManager manager) {
            removePreviousLRUFilterActions(manager);
            addLRUFilterActions(manager);
        }
    };
    fMenuManager.addMenuListener(fMenuListener);
}
项目:Eclipse-Postfix-Code-Completion    文件:RefactorActionGroup.java   
private void addRefactorSubmenu(IMenuManager menu) {
    MenuManager refactorSubmenu= new MenuManager(ActionMessages.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() {
                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);
    }
}
项目:Eclipse-Postfix-Code-Completion    文件:GenerateBuildPathActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
       super.fillContextMenu(menu);
       if (!canOperateOnSelection())
        return;
       String menuText= ActionMessages.BuildPath_label;
       IMenuManager subMenu= new MenuManager(menuText, MENU_ID);
       subMenu.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager manager) {
            fillViewSubMenu(manager);
        }
       });
       subMenu.setRemoveAllWhenShown(true);
       subMenu.add(new ConfigureBuildPathAction(fSite));
       menu.appendToGroup(fGroupName, subMenu);
   }
项目:karaf-eik    文件:BundlesView.java   
protected void initContextMenu() {
    final MenuManager menuMgr = new MenuManager("#PopupMenu"); //$NON-NLS-1$
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {
        @Override
        public void menuAboutToShow(final IMenuManager manager) {
            menuMgr.add(propertiesAction);
            menuMgr.add(new Separator());
            menuMgr.add(new Separator(IWorkbenchActionConstants.MB_ADDITIONS));
        }
    });

    final Menu menu = menuMgr.createContextMenu(treeTableViewer.getControl());
    treeTableViewer.getControl().setMenu(menu);
    getSite().registerContextMenu(menuMgr, treeTableViewer);
}
项目:SPLevo    文件:VPMRefinementBrowser.java   
/**
 * initialize the context menu.
 */
private void initContextMenu() {
    MenuManager menuMgr = new MenuManager();
    final VPMRefinementBrowser browser = this;
    menuMgr.setRemoveAllWhenShown(true);
    menuMgr.addMenuListener(new IMenuListener() {

        @Override
        public void menuAboutToShow(IMenuManager manager) {
            Action action = new DeleteRefinementAction(refinementListView, detailsView);
            manager.add(action);
            action = new RenameRefinementAction(refinementListView);
            manager.add(action);
            action = new RefinementEditDescriptionAction(refinementListView);
            manager.add(action);
            action = new ApplySelectedRefinementsAction(browser, "Apply Selected Refinements");
            manager.add(action);
        }
    });
    menuMgr.addMenuListener(new CommandActionMenuListener("org.splevo.ui.commands.argouml.variantscan",
            SPLevoUIPlugin.getImageDescriptor("icons/kopl_circle_only.png")));
    Menu menu = menuMgr.createContextMenu(refinementListView.getTree());
    refinementListView.getTree().setMenu(menu);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:CustomFiltersActionGroup.java   
/**
 * Fills the given view menu with the entries managed by the
 * group.
 *
 * @param viewMenu the menu to fill
 */
public void fillViewMenu(IMenuManager viewMenu) {
    /*
     * Don't change the separator group name.
     * Using this name ensures that other filters
     * get contributed to the same group.
     */
    viewMenu.add(new Separator("filters")); //$NON-NLS-1$
    viewMenu.add(new GroupMarker(RECENT_FILTERS_GROUP_NAME));
    viewMenu.add(new ShowFilterDialogAction());

    fMenuManager= viewMenu;
    fMenuListener= new IMenuListener() {
        public void menuAboutToShow(IMenuManager manager) {
            removePreviousLRUFilterActions(manager);
            addLRUFilterActions(manager);
        }
    };
    fMenuManager.addMenuListener(fMenuListener);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:RefactorActionGroup.java   
private void addRefactorSubmenu(IMenuManager menu) {
    MenuManager refactorSubmenu= new MenuManager(ActionMessages.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() {
                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);
    }
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:SearchScopeActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
    MenuManager javaSearchMM = new MenuManager(CallHierarchyMessages.SearchScopeActionGroup_searchScope,
            IContextMenuConstants.GROUP_SEARCH);
    javaSearchMM.setRemoveAllWhenShown(true);

    javaSearchMM.addMenuListener(new IMenuListener() {
        /* (non-Javadoc)
         * @see org.eclipse.jface.action.IMenuListener#menuAboutToShow(org.eclipse.jface.action.IMenuManager)
         */
        public void menuAboutToShow(IMenuManager manager) {
            fillSearchActions(manager);
        }
    });

    fillSearchActions(javaSearchMM);
    menu.appendToGroup(IContextMenuConstants.GROUP_SEARCH, javaSearchMM);
}
项目:Eclipse-Postfix-Code-Completion-Juno38    文件:GenerateBuildPathActionGroup.java   
@Override
public void fillContextMenu(IMenuManager menu) {
       super.fillContextMenu(menu);
       if (!canOperateOnSelection())
        return;
       String menuText= ActionMessages.BuildPath_label;
       IMenuManager subMenu= new MenuManager(menuText, MENU_ID);
       subMenu.addMenuListener(new IMenuListener() {
        public void menuAboutToShow(IMenuManager manager) {
            fillViewSubMenu(manager);
        }
       });
       subMenu.setRemoveAllWhenShown(true);
       subMenu.add(new ConfigureBuildPathAction(fSite));
       menu.appendToGroup(fGroupName, subMenu);
   }