Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChris Aniszczyk2011-01-17 16:56:39 +0000
committerChris Aniszczyk2011-01-17 22:41:05 +0000
commit8322857a739a69759ee8e7841a8487d0a1661792 (patch)
tree0f2d63954cbb4890be0a42a87cbca62a61340836 /org.eclipse.egit.mylyn.ui/src/org
parent02aa9fed64c721611ec11ae4bf1472d0210ae436 (diff)
downloadegit-8322857a739a69759ee8e7841a8487d0a1661792.tar.gz
egit-8322857a739a69759ee8e7841a8487d0a1661792.tar.xz
egit-8322857a739a69759ee8e7841a8487d0a1661792.zip
Add initial EGit Mylyn integration
Generates the commit dialog message by getting the active mylyn task. The commit message is generated by combinging the title with description and commit message template defined in the mylyn preferences. Bug: 306001 Change-Id: I344546626c8cb089c019db08afa400e4847e6fc4 Signed-off-by: Chris Aniszczyk <caniszczyk@gmail.com> Signed-off-by: Benjamin Muskalla <benjamin.muskalla@tasktop.com>
Diffstat (limited to 'org.eclipse.egit.mylyn.ui/src/org')
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/EGitMylynUI.java52
-rw-r--r--org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java47
2 files changed, 99 insertions, 0 deletions
diff --git a/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/EGitMylynUI.java b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/EGitMylynUI.java
new file mode 100644
index 0000000000..15b411f80a
--- /dev/null
+++ b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/EGitMylynUI.java
@@ -0,0 +1,52 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Chris Aniszczyk and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ *******************************************************************************/
+package org.eclipse.egit.internal.mylyn.ui;
+
+import org.eclipse.ui.plugin.AbstractUIPlugin;
+import org.osgi.framework.BundleContext;
+
+/**
+ * The activator class controls the plug-in life cycle
+ */
+public class EGitMylynUI extends AbstractUIPlugin {
+
+ // The plug-in ID
+ public static final String PLUGIN_ID = "org.eclipse.egit.mylyn.ui"; //$NON-NLS-1$
+
+ // The shared instance
+ private static EGitMylynUI plugin;
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#start(org.osgi.framework.BundleContext)
+ */
+ public void start(BundleContext context) throws Exception {
+ super.start(context);
+ plugin = this;
+ }
+
+ /*
+ * (non-Javadoc)
+ * @see org.eclipse.ui.plugin.AbstractUIPlugin#stop(org.osgi.framework.BundleContext)
+ */
+ public void stop(BundleContext context) throws Exception {
+ plugin = null;
+ super.stop(context);
+ }
+
+ /**
+ * @return the shared instance
+ */
+ public static EGitMylynUI getDefault() {
+ return plugin;
+ }
+
+}
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
new file mode 100644
index 0000000000..b505aa0b42
--- /dev/null
+++ b/org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java
@@ -0,0 +1,47 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Chris Aniszczyk and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Chris Aniszczyk <caniszczyk@gmail.com> - initial API and implementation
+ * Manuel Doninger <manuel@doninger.net>
+ * Benjamin Muskalla <benjamin.muskalla@tasktop.com>
+ * Thorsten Kamann <thorsten@kamann.info>
+ *******************************************************************************/
+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.tasks.core.ITask;
+import org.eclipse.mylyn.tasks.core.ITaskActivityManager;
+import org.eclipse.mylyn.tasks.ui.TasksUi;
+
+
+/**
+ * Gets the active task and combines the description and title with
+ * the commit message template defined in the preferences
+ */
+@SuppressWarnings("restriction")
+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)
+ 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);
+ return message;
+ }
+
+}

Back to the top