Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorManuel Doninger2011-01-21 15:17:26 +0000
committerMatthias Sohn2011-01-21 15:17:26 +0000
commit9859d128313b86d3aad8aa13cdcea96153150e06 (patch)
tree2476091ac340a8fe571bd9bffa14391fddef36d5 /org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal
parentf7f8ef8b0f4d43f471bc50eb57115a0b41f3b18d (diff)
downloadegit-9859d128313b86d3aad8aa13cdcea96153150e06.tar.gz
egit-9859d128313b86d3aad8aa13cdcea96153150e06.tar.xz
egit-9859d128313b86d3aad8aa13cdcea96153150e06.zip
Fetch commit message template from project specific settings
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>
Diffstat (limited to 'org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal')
-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 b505aa0b42..f191c0693e 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();
+ }
}

Back to the top