无法扩展帮助菜单

Not able to extend the Help menu

我想从 eclipse 插件中添加一个 Request Support 按钮到 Help 菜单。

我先从 *.e4xmi 文件尝试,现在我从 plugin.xml 尝试,但仍然无法使按钮出现在 Help 菜单下。

我在 Eclipse Spy Plug-in 的帮助下获得了菜单 URI。
plugin.xml的内容:

<extension
    point="org.eclipse.ui.menus">
    <menuContribution
        allPopups="false" (tried with true and same result)
        locationURI="menu:help?after=about">
        <menu
            commandId="com.plugin.RequestSupport"
            id="requestSupport"
            label="Request Support">
        </menu>
    </menuContribution>
</extension>
<extension
    point="org.eclipse.ui.commands">
    <command
        defaultHandler="com.plugin.handlers.RequestSupportHandler"
        description="Opens up default e-mail client with preset basic informations"
        id="com.plugin.RequestSupport"
        name="Request Support">
    </command>
</extension>

我错过了什么?

格雷格回答的解决方案:

<extension
    point="org.eclipse.ui.menus">
    <menuContribution
        allPopups="false" (tried with true and same result)
        locationURI="menu:help?after=about">

        <menu
            commandId="com.plugin.RequestSupport"
            id="requestSupport"
            label="Request Support">
        </menu>

        <command
            commandId="com.plugin.RequestSupport"
            id="requestSupport"
            label="Request Support"
            style="push">
        </command>
    </menuContribution>
</extension>

这是'Check for Updates'使用的:

<extension
     point="org.eclipse.ui.menus">
  <menuContribution
        locationURI="menu:help?after=additions">
        <command
              commandId="org.eclipse.equinox.p2.ui.sdk.update"
              mnemonic="%Update.command.mnemonic"
              id="org.eclipse.equinox.p2.ui.sdk.update"
              icon="icons/obj/iu_update_obj.png">
        </command>

在 'additions' 位置之后添加。

创建帮助菜单的代码定义了很多位置:

private MenuManager createHelpMenu() {
    MenuManager menu = new MenuManager(IDEWorkbenchMessages.Workbench_help, IWorkbenchActionConstants.M_HELP);
    addSeparatorOrGroupMarker(menu, "group.intro"); //$NON-NLS-1$
    // See if a welcome or intro page is specified
    if (introAction != null) {
        menu.add(introAction);
    } else if (quickStartAction != null) {
        menu.add(quickStartAction);
    }
    menu.add(new GroupMarker("group.intro.ext")); //$NON-NLS-1$
    addSeparatorOrGroupMarker(menu, "group.main"); //$NON-NLS-1$
    menu.add(helpContentsAction);
    menu.add(helpSearchAction);
    menu.add(dynamicHelpAction);
    addSeparatorOrGroupMarker(menu, "group.assist"); //$NON-NLS-1$
    // See if a tips and tricks page is specified
    if (tipsAndTricksAction != null) {
        menu.add(tipsAndTricksAction);
    }
    // HELP_START should really be the first item, but it was after
    // quickStartAction and tipsAndTricksAction in 2.1.
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_START));
    menu.add(new GroupMarker("group.main.ext")); //$NON-NLS-1$
    addSeparatorOrGroupMarker(menu, "group.tutorials"); //$NON-NLS-1$
    addSeparatorOrGroupMarker(menu, "group.tools"); //$NON-NLS-1$
    addSeparatorOrGroupMarker(menu, "group.updates"); //$NON-NLS-1$
    menu.add(new GroupMarker(IWorkbenchActionConstants.HELP_END));
    addSeparatorOrGroupMarker(menu, IWorkbenchActionConstants.MB_ADDITIONS);
    // about should always be at the bottom
    menu.add(new Separator("group.about")); //$NON-NLS-1$

    ActionContributionItem aboutItem = new ActionContributionItem(aboutAction);
    aboutItem.setVisible(!Util.isMac());
    menu.add(aboutItem);
    menu.add(new GroupMarker("group.about.ext")); //$NON-NLS-1$
    return menu;
}

(来自 org.eclipse.ui.internal.ide.WorkbenchActionBuilder

所有 addSeparatorOrGroupMarkernew Separatornew GroupMaker 调用都定义了可以在之后添加的 ID。