summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorManuel Doninger2011-01-21 10:17:26 (EST)
committer Matthias Sohn2011-01-21 10:17:26 (EST)
commit9859d128313b86d3aad8aa13cdcea96153150e06 (patch)
tree2476091ac340a8fe571bd9bffa14391fddef36d5
parentf7f8ef8b0f4d43f471bc50eb57115a0b41f3b18d (diff)
downloadegit-9859d128313b86d3aad8aa13cdcea96153150e06.zip
egit-9859d128313b86d3aad8aa13cdcea96153150e06.tar.gz
egit-9859d128313b86d3aad8aa13cdcea96153150e06.tar.bz2
Fetch commit message template from project specific settings refs/changes/89/2289/3
Resources of the commit are registered and the commit template of the project, that contains a resource to commit is used for the commit message. If resources of multiple projects with their own template are committed, then the template of the first project in the workspace is taken. Bug: 334879 Change-Id: I0ba46429790630787497f00ffdfb26bd6b9b5157 Signed-off-by: Manuel Doninger <manuel.doninger@googlemail.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java36
1 files changed, 26 insertions, 10 deletions
diff --git a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java
index b505aa0..f191c06 100644
--- a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java
+++ b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java
@@ -15,9 +15,10 @@ package org.eclipse.egit.internal.mylyn.ui.commit;
import org.eclipse.core.resources.IResource;
import org.eclipse.egit.ui.ICommitMessageProvider;
-import org.eclipse.mylyn.internal.team.ui.FocusedTeamUiPlugin;
+import org.eclipse.mylyn.context.core.ContextCore;
+import org.eclipse.mylyn.context.core.IInteractionContext;
+import org.eclipse.mylyn.internal.team.ui.ContextChangeSet;
import org.eclipse.mylyn.tasks.core.ITask;
-import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
import org.eclipse.mylyn.tasks.ui.TasksUi;
@@ -32,16 +33,31 @@ public class MylynCommitMessageProvider implements ICommitMessageProvider {
* @return the mylyn commit message template defined in the preferences
*/
public String getMessage(IResource[] resources) {
- String message = "";
- ITaskActivityManager tam = TasksUi.getTaskActivityManager();
- ITask task = tam.getActiveTask();
- if(task == null)
+ String message = ""; //$NON-NLS-1$
+ if (resources == null)
return message;
- // generate the comment based on the active mylyn task
- String template = FocusedTeamUiPlugin.getDefault().getPreferenceStore().getString(FocusedTeamUiPlugin.COMMIT_TEMPLATE);
- FocusedTeamUiPlugin.getDefault().getCommitTemplateManager().generateComment(task, template);
- message = FocusedTeamUiPlugin.getDefault().getCommitTemplateManager().generateComment(task, template);
+ ITask task = getCurrentTask();
+ if (task == null)
+ return message;
+ boolean checkTaskRepository = true;
+ message = ContextChangeSet.getComment(checkTaskRepository, task,
+ resources);
+
return message;
}
+ /**
+ * @return the currently activated task or <code>null</code> if no task is
+ * activated
+ */
+ protected ITask getCurrentTask() {
+ return TasksUi.getTaskActivityManager().getActiveTask();
+ }
+
+ /**
+ * @return the activecontext or <code>null</code> if no activecontext exists
+ */
+ protected IInteractionContext getActiveContext() {
+ return ContextCore.getContextManager().getActiveContext();
+ }
}