Wednesday, 15 April 2015

eclipse - How to always enable command handler in Egit -



eclipse - How to always enable command handler in Egit -

in egit, ..... when right click project, click "show in history", history view shows list of commits, select 1 commit, right click , pop menu shows (checkout, create branch, create tag, .....revision comment). need add together new item in pop menu called "add factory", when click it, go "addtofactoryhandler" implementation.

i want menu item there when right click commit in history view.

class="lang-xml prettyprint-override"><extension point="org.eclipse.ui.menus"> <menucontribution locationuri="popup:org.eclipse.egit.ui.historypagecontributions"> <command defaulthandler="xxxxxxxxxxx.addtofactoryhandler" commandid="xxxxxxxxxx.addtofactory" label="addtofactory" style="push" > </command> </menucontribution> </extension> <extension point="org.eclipse.ui.handlers"> <handler class="xxxxxxxxxxx.addtofactoryhandler" commandid="xxxxxxxxxx.addtofactory"> </handler> </extension>

then in history view, first time select commit, right click , popup menu shows grayed out "add factory". sec time, right click , goes away.

i appreciate help .. thanks!

you need utilize org.eclipse.ui.commands extension point define command id.

also note command in menucontribution not have defaulthandler parameter.

so like:

class="lang-xml prettyprint-override"><extension point="org.eclipse.ui.commands"> <command id="xxxxxxxxxx.addtofactory" defaulthandler="xxxxxxxxxxx.addtofactoryhandler" description="description" name="name"> </command> </extension> <extension point="org.eclipse.ui.menus"> <menucontribution locationuri="popup:org.eclipse.egit.ui.historypagecontributions"> <command commandid="xxxxxxxxxx.addtofactory" label="addtofactory" style="push" > </command> </menucontribution> </extension> <extension point="org.eclipse.ui.handlers"> <handler class="xxxxxxxxxxx.addtofactoryhandler" commandid="xxxxxxxxxx.addtofactory"> </handler> </extension>

eclipse git plugins

No comments:

Post a Comment