无法将菜单项添加到Egit历史记录视图菜单

时间:2014-10-12 20:42:32

标签: egit

在Egit中,.....当右键单击项目,然后单击"在历史记录中显示",历史记录视图显示所有提交的列表,选择一个提交,右键单击,弹出菜单显示(结帐,创建分支,创建标签,.....修订注释)。我需要做的是在这个名为"添加到工厂"的弹出菜单中添加一个新项目,然后在点击它时,转到" AddToFactoryHandler"做实施。

从Egit的源代码中,此菜单ID为" org.eclipse.egit.ui.historyPageContributions",

(1)
    <extension  point="org.eclipse.ui.commands">
          <command
                id="xxxxxxxxxx.AddToFactory"
                defaultHandler="xxxxxxxxxxx.AddToFactoryHandler"
                description="description"
                name="AddToFactory">
          </command>
    </extension>

    <extension point="org.eclipse.ui.handlers">
        <handler  
             commandId="xxxxxxxxxx.AddToFactory">
             <class
                   class="xxxxxxxxxxx.AddToFactoryHandler">
             </class>
               <activeWhen>
                <and>
                   <count
                         value="1">
                   </count>
                   <iterate>
                      <adapt
                            type="org.eclipse.jgit.lib.ReflogEntry">
                      </adapt>
                   </iterate>
                </and>
             </activeWhen>
        </handler>
    </extension>

    <extension
             point="org.eclipse.ui.menus">
          <menuContribution
                locationURI="popup:org.eclipse.egit.ui.historyPageContributions">

             <command
                   commandId="xxxxxxxxxx.AddToFactory"
                   label="AddToFactory"
                   style="push">
             </command>
      </extension> 

(2) <extension point="org.eclipse.ui.menus">
      <menuContribution locationURI="popup:org.eclipse.egit.ui.historyPageContributions">
         <command commandId="xxxxxxxxxx.AddToFactory" style="push">
            <visibleWhen checkEnabled="true"/>
         </command>
      </menuContribution>
   </extension>


   <extension point="org.eclipse.ui.handlers">
      <handler
            class="xxxxxxxxxxx.AddToFactoryHandler"
            commandId="xxxxxxxxxx.AddToFactory">
         <enabledWhen>
            <and>
               <with variable="activePartId">
                  <equals value="org.eclipse.egit.ui.historyPageContributions"/>
               </with>
               <with variable="activeMenuSelection">
                  <iterate ifEmpty="false">
                     <adapt type="org.eclipse.jgit.lib.ReflogEntry"/>
                  </iterate>
               </with>
            </and>
         </enabledWhen>
      </handler>
   </extension>

无论哪种方式,当我在历史记录视图和右侧clcik中选择提交时,&#34; AddToFActory&#34;永远不会出现在弹出菜单中。知道如何在这样的弹出菜单中添加项目吗?非常感谢您的帮助?

0 个答案:

没有答案