コード例 #1
0
  /*
   * @see org.eclipse.ui.part.EditorActionBarContributor#contributeToMenu(org.eclipse.jface.action.IMenuManager)
   */
  @Override
  public void contributeToMenu(IMenuManager menu) {

    super.contributeToMenu(menu);

    IMenuManager editMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
    if (editMenu != null) {

      MenuManager structureSelection =
          new MenuManager(
              JavaEditorMessages.ExpandSelectionMenu_label, "expandSelection"); // $NON-NLS-1$
      editMenu.insertAfter(ITextEditorActionConstants.SELECT_ALL, structureSelection);
      structureSelection.add(fStructureSelectEnclosingAction);
      structureSelection.add(fStructureSelectNextAction);
      structureSelection.add(fStructureSelectPreviousAction);
      structureSelection.add(fStructureSelectHistoryAction);

      editMenu.appendToGroup(
          ITextEditorActionConstants.GROUP_INFORMATION, fRetargetShowInformationAction);
    }

    IMenuManager navigateMenu = menu.findMenuUsingPath(IWorkbenchActionConstants.M_NAVIGATE);
    if (navigateMenu != null) {
      navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fShowOutline);
      navigateMenu.appendToGroup(IWorkbenchActionConstants.SHOW_EXT, fOpenHierarchy);
    }

    IMenuManager gotoMenu = menu.findMenuUsingPath("navigate/goTo"); // $NON-NLS-1$
    if (gotoMenu != null) {
      gotoMenu.add(new Separator("additions2")); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoPreviousMemberAction); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoNextMemberAction); // $NON-NLS-1$
      gotoMenu.appendToGroup("additions2", fGotoMatchingBracket); // $NON-NLS-1$
    }
  }
  @Override
  public void contributeToMenu(IMenuManager menuManager) {
    super.contributeToMenu(menuManager);

    MenuManager sourceMenu = new MenuManager("Source");
    menuManager.insertAfter(IWorkbenchActionConstants.MB_ADDITIONS, sourceMenu);
    sourceMenu.add(this.commentAction);
    sourceMenu.add(this.uncommentAction);
    sourceMenu.add(this.toggleCommentsAction);
  }
コード例 #3
0
 /** Adds the three items to the edit-menu */
 @Override
 public void contributeToMenu(IMenuManager mm) {
   super.contributeToMenu(mm);
   IMenuManager editMenu = mm.findMenuUsingPath(IWorkbenchActionConstants.M_EDIT);
   if (editMenu != null) {
     editMenu.add(new Separator());
     editMenu.add(contentAssistProposal);
     editMenu.add(formatProposal);
     editMenu.add(contentAssistContextInformation);
   }
 }