Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Could not add menu item to Egit history View menu(Could not add menu item to Egit history View menu)
Could not add menu item to Egit history View menu [message #1443487] Sun, 12 October 2014 20:48
Ruhong Cai is currently offline Ruhong CaiFriend
Messages: 4
Registered: October 2014
Junior Member
In Egit, ..... when right click the project, then click "Show in History", the history View shows the list of all commits, select one commit, right click , the pop up menu shows (Checkout, Create Branch, Create Tag, .....Revision Comment). What I need to do is to add a new item in this pop up menu called "Add To Factory", then when click it , go to "AddToFactoryHandler" to do the implementation.

From the source code in Egit, this menu id is "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>


Either way, when I select the commit in the history view and right clcik , "AddToFActory" never show up in the pop up menu. Any idea how to add item to such pop up menu? Thanks a lot for the help?


Previous Topic:How to always enable command handler in Egit
Next Topic:can not switch to another branch
Goto Forum:
  


Current Time: Fri Apr 19 19:30:28 GMT 2024

Powered by FUDForum. Page generated in 0.02998 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top