Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » EGit / JGit » Modify commit message from Eclipse plugin
Modify commit message from Eclipse plugin [message #1763583] Wed, 17 May 2017 15:46 Go to next message
Mikey Hansen is currently offline Mikey HansenFriend
Messages: 1
Registered: May 2017
Junior Member
Hi,

I'm working on an Eclipse RCP plugin that is supposed to modify (according to some settings) the commit message in the Git Staging View and Commit Dialog. I can see that this feature is available in the EGit Mylyn plugin where the message is preset to match the currently selected task. I cloned the GitHub Mylyn Connector from https://github.com/eclipse/egit-github and I'm trying to figure out how this is achieved. Can you point me to some relevant code samples or give me any helpful hints?

Thanks
Re: Modify commit message from Eclipse plugin [message #1763771 is a reply to message #1763583] Fri, 19 May 2017 13:03 Go to previous message
Thomas Wolf is currently offline Thomas WolfFriend
Messages: 11
Registered: August 2016
Junior Member
Modifying an existing commit message is not supported.

You can provide an initial commit message with a ICommitMessageProvider registered through the org.eclipse.egit.ui.commitMessageProvider extension point.

For instance:
package org.example.myapp;

import org.eclipse.core.resources.IResource;
import org.eclipse.egit.ui.ICommitMessageProvider;

public class DummyCommitMessageProvider implements ICommitMessageProvider {

	@Override
	public String getMessage(IResource[] resources) {
		return "This is a dummy message\n";
	}

}

and in your bundle's plugin.xml:
 <extension
         id="org.example.myapp.commitMessage"
         point="org.eclipse.egit.ui.commitMessageProvider">
    <commitMessageProvider
            class="org.example.myapp.DummyCommitMessageProvider">
    </commitMessageProvider>
 </extension>
Previous Topic:How to replace local branch with remote branch
Next Topic:Super slow right click on branch in history window
Goto Forum:
  


Current Time: Tue May 30 03:41:19 GMT 2017

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

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