Eclipse插件:在SVN中添加新菜单>团队弹出菜单

时间:2013-12-24 08:55:09

标签: java eclipse svn plugins

我正在开发一个Eclipse插件。我想在eclipse的SVN插件的现有菜单中添加新的附加菜单(右键单击项目名称并从弹出窗口中选择“Team”菜单时显示)

这是我的plugin.xml

<?xml version="1.0" encoding="UTF-8"?>
    <?eclipse version="3.4"?>
      <plugin>
          <extension point = "org.eclipse.ui.popupMenus">
             <objectContribution id="com.company.svn.checkout" objectClass="org.eclipse.core.resources.IProject">
        <menu
            id="com.company.svn.checkout.CheckoutProjectStructure"
            label="Team"
            path="additions">
            <separator name="group1"/>
        </menu>
        <action id="com.company.svn.checkout.submenu.CheckoutProjectStructure"
           label="Update Project Data"
           icon="icons/renameProject.png"
           menubarPath="com.company.svn.checkout.CheckoutProjectStructure/group1" 
           helpContextId="com.company.svn.checkout.CheckoutProjectStructure"
           class="com.company.svn.checkout.UpdateProjectDataDelegate"
           enablesFor="1">
        </action>
     </objectContribution>
</extension>

但它只是添加了新的单独菜单,弹出窗口中有两个菜单“Team”。如何将它们“合并”到1个菜单中?

1 个答案:

答案 0 :(得分:1)

您需要在team.main

中指定现有的menubarPath菜单

例如SVN行动之一:

<objectContribution
    adaptable="true"
    objectClass="org.eclipse.core.resources.IProject"
    id="org.eclipse.team.svn.ui.ConnectedProjectContributions">

    <action
        label="%DisconnectAction.label"
        helpContextId="org.eclipse.team.svn.ui.team_disconnect_action_context"
        class="org.eclipse.team.svn.ui.action.local.management.DisconnectAction"
        tooltip="%DisconnectAction.tooltip"
        menubarPath="team.main/projectGroup"
        definitionId="org.eclipse.team.svn.ui.command.DisconnectCommand"
        id="org.eclipse.team.svn.ui.action.local.management.DisconnectAction">
    </action>

</objectContribution>