Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » How to integrate with Egit for adding a new item in Commit menu from history view(How to integrate with Egit for adding a new item in Commit menu from history view)
How to integrate with Egit for adding a new item in Commit menu from history view [message #1441574] Thu, 09 October 2014 23:09
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.

I study the Egit source code and found out this popup menu id is "org.eclipse.egit.ui.historyPageContributions" (in org.eclipse.egit.ui.internal.history.GitHistoryPage.java)

Then in plugin.xml, I added (1)

<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popup:org.eclipse.egit.ui.historyPageContributions">
<command commandId="xxxxxxxxxx.AddToFactory" label="Add To Factory" style="push">
</command>
</menuContribution>
Then in history view, the first time I select any commit, right click , the popup menu shows grayed out "Add To Factory". then the second time, right click , it goes away.

(2)

<extension point="org.eclipse.ui.menus">
<menuContribution locationURI="popup:org.eclipse.egit.ui.historyPageContributions">
<command commandId="xxxxxxxxxx.AddToFactory" label="Add To Factory" style="push">
<visibleWhen checkEnabled="true"/>
</command>
</menuContribution>
</extension>
<extension point="org.eclipse.ui.handlers">
<handler
class="xxxxxxxxxxx.AddToFactoryHandler"
commandId="xxxxxxxxxx.AddToFactory"> <!-- same as above -->
<enabledWhen>
<count
value="1">
</count>
<with variable="activeMenuSelection">
<iterate ifEmpty="false">

<adapt type="org.eclipse.jgit.revwalk.RevCommit"/>
</iterate>
</with>
</enabledWhen>
</handler>
Then "Add To Factory" does not show up in the pop up menu.I do appreciate any help .. Thanks!
Previous Topic:Signing Commits
Next Topic:How to always enable command handler in Egit
Goto Forum:
  


Current Time: Fri Dec 13 00:09:45 GMT 2019

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

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

Back to the top