Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » EGit - Disable Commit button(EGit - Disable Commit button from extension plugin)
EGit - Disable Commit button [message #1756243] Tue, 14 March 2017 13:04
Suresh P is currently offline Suresh PFriend
Messages: 21
Registered: May 2013
Junior Member
HI

Im creating custom popup menu item ("Custom Commit"), similar to "Commit" menu (right-click Team->Commit). Created a new extension plugin for this new menu item.
My requirement is, when this plugin is installed in IDE, the existing "Commit" menu button should be Disabled.
Can you let me know what changes I have to do in extension plugin code for disabling the "Commit" menu.

Plugin.xml for this extension plugin is given below for reference.

Plugin.xml of Extension plugin:


<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.4"?>
<plugin>

	<extension point="org.eclipse.ui.popupMenus">
		
		<objectContribution
			objectClass="org.eclipse.core.resources.IResource"
			adaptable="true" id="org.eclipse.egit.ui.resourceContributions">
			  <filter name="projectPersistentProperty"
               value="org.eclipse.team.core.repository=org.eclipse.egit.core.GitProvider">
         </filter>

			 <action
               class="com.mycomp.custom.plugin.GITCommitAction"
               definitionId="org.eclipse.egit.ui.team.MyCommit"
               icon="icons/custom.jpg"
               id="com.mycomp.custom.plugin.GITCommitAction"
               label="Custom Commit..."
               menubarPath="team.main/group1">
			</action>
			
		</objectContribution>
		
			
	</extension>
<extension
         point="org.eclipse.ui.actionSets">
      <actionSet
           description="GitActions_description"
           id="org.eclipse.egit.ui.gitaction"
           label="GitActions_label"
           visible="false">
         <menu
           id="org.eclipse.egit.ui.gitmenu"
           label="GitMenu_label"
           path="additions">
            <separator name="repositoryGroup" />
	     </menu>    
	<action
           class="com.mycomp.custom.plugin.GITCommitAction"
           definitionId="org.eclipse.egit.ui.team.MyCommit"
           id="org.eclipse.egit.ui.myactioncommit"
           label="Custom Git Commit"
           menubarPath="org.eclipse.egit.ui.gitmenu/repositoryGroup"
           style="push"
           toolbarPath="Normal/additions"
           tooltip="Custom Git Commit">
         </action>
          </actionSet>
	  </extension>	 
   <extension
         point="org.eclipse.ui.handlers">		 
		   <handler
            commandId="org.eclipse.egit.ui.team.MyCommit">
         <class
               class="com.mycomp.custom.plugin.GITCommitActionHandler">
         </class>
         <activeWhen>
            <or>
               <reference
                     definitionId="org.eclipse.egit.ui.resourcesSingleRepository">
               </reference>
               <and>
                  <count
                        value="1">
                  </count>
                  <iterate>
                     <and>
                        <instanceof
                              value="org.eclipse.egit.ui.internal.repository.tree.RepositoryTreeNode">
                        </instanceof>
                        <not>
                           <test
                                 property="GitRepository.isBare">
                           </test>
                        </not>
                     </and>
                  </iterate>
               </and>
            </or>
         </activeWhen>
      </handler>  
   </extension>
   <extension
         name="SharedCommandsLabel"
         point="org.eclipse.ui.commands">
         <command
            categoryId="org.eclipse.egit.ui.commandCategory"
            id="org.eclipse.egit.ui.team.MyCommit"
            name="CommitCommand.name">
      </command>
      </extension>
            
</plugin>



Custom class - GitCommitAction.java

public class GITCommitAction extends RepositoryAction  {
	public GITCommitAction()
	  {
	    super("org.eclipse.egit.ui.team.MyCommit", new GITCommitActionHandler());
	  }
}

[Updated on: Fri, 17 March 2017 05:16]

Report message to a moderator

Previous Topic:New Project Wizard in import from Git wizard
Next Topic:Share project programatically
Goto Forum:
  


Current Time: Sat May 27 17:38:35 GMT 2017

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

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