diff options
author | Chris Aniszczyk | 2011-01-17 16:56:39 +0000 |
---|---|---|
committer | Chris Aniszczyk | 2011-01-17 22:41:05 +0000 |
commit | 8322857a739a69759ee8e7841a8487d0a1661792 (patch) | |
tree | 0f2d63954cbb4890be0a42a87cbca62a61340836 /org.eclipse.egit.mylyn.ui | |
parent | 02aa9fed64c721611ec11ae4bf1472d0210ae436 (diff) | |
download | egit-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')
-rw-r--r-- | org.eclipse.egit.mylyn.ui/.classpath | 7 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/.gitignore | 2 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/.project | 28 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.core.prefs | 8 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF | 26 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/build.properties | 6 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/plugin.properties | 12 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/plugin.xml | 10 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/pom.xml | 53 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/EGitMylynUI.java | 52 | ||||
-rw-r--r-- | org.eclipse.egit.mylyn.ui/src/org/eclipse/egit/internal/mylyn/ui/commit/MylynCommitMessageProvider.java | 47 |
11 files changed, 251 insertions, 0 deletions
diff --git a/org.eclipse.egit.mylyn.ui/.classpath b/org.eclipse.egit.mylyn.ui/.classpath new file mode 100644 index 0000000000..64c5e31b7a --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/.classpath @@ -0,0 +1,7 @@ +<?xml version="1.0" encoding="UTF-8"?> +<classpath> + <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.5"/> + <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/> + <classpathentry kind="src" path="src"/> + <classpathentry kind="output" path="bin"/> +</classpath> diff --git a/org.eclipse.egit.mylyn.ui/.gitignore b/org.eclipse.egit.mylyn.ui/.gitignore new file mode 100644 index 0000000000..fb60f67b1e --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/.gitignore @@ -0,0 +1,2 @@ +bin/ +target/ diff --git a/org.eclipse.egit.mylyn.ui/.project b/org.eclipse.egit.mylyn.ui/.project new file mode 100644 index 0000000000..7b1e0d2873 --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/.project @@ -0,0 +1,28 @@ +<?xml version="1.0" encoding="UTF-8"?> +<projectDescription> + <name>org.eclipse.egit.mylyn.ui</name> + <comment></comment> + <projects> + </projects> + <buildSpec> + <buildCommand> + <name>org.eclipse.jdt.core.javabuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.ManifestBuilder</name> + <arguments> + </arguments> + </buildCommand> + <buildCommand> + <name>org.eclipse.pde.SchemaBuilder</name> + <arguments> + </arguments> + </buildCommand> + </buildSpec> + <natures> + <nature>org.eclipse.pde.PluginNature</nature> + <nature>org.eclipse.jdt.core.javanature</nature> + </natures> +</projectDescription> diff --git a/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.core.prefs b/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.core.prefs new file mode 100644 index 0000000000..210e46bb13 --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/.settings/org.eclipse.jdt.core.prefs @@ -0,0 +1,8 @@ +#Tue Aug 17 14:18:25 CDT 2010 +eclipse.preferences.version=1 +org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled +org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.5 +org.eclipse.jdt.core.compiler.compliance=1.5 +org.eclipse.jdt.core.compiler.problem.assertIdentifier=error +org.eclipse.jdt.core.compiler.problem.enumIdentifier=error +org.eclipse.jdt.core.compiler.source=1.5 diff --git a/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF new file mode 100644 index 0000000000..af13c90d2b --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/META-INF/MANIFEST.MF @@ -0,0 +1,26 @@ +Manifest-Version: 1.0 +Bundle-ManifestVersion: 2 +Bundle-Name: %Bundle-Name +Bundle-SymbolicName: org.eclipse.egit.mylyn.ui;singleton:=true +Bundle-Version: 0.11.0.qualifier +Bundle-Activator: org.eclipse.egit.internal.mylyn.ui.EGitMylynUI +Bundle-Vendor: %Bundle-Vendor +Require-Bundle: org.eclipse.team.core, + org.eclipse.jface, + org.eclipse.core.resources, + org.eclipse.core.runtime, + org.eclipse.ui.navigator.resources, + org.eclipse.ui.workbench, + org.eclipse.mylyn.monitor.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.mylyn.tasks.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.mylyn.tasks.ui;bundle-version="[3.0.0,4.0.0)", + org.eclipse.mylyn.team.ui;bundle-version="[3.0.0,4.0.0)", + org.eclipse.mylyn.resources.ui;bundle-version="[3.0.0,4.0.0)", + org.eclipse.mylyn.context.core;bundle-version="[3.0.0,4.0.0)", + org.eclipse.egit.core;bundle-version="[0.11.0,1.0.0)", + org.eclipse.egit.ui;bundle-version="[0.11.0,1.0.0)" +Bundle-RequiredExecutionEnvironment: J2SE-1.5 +Bundle-ActivationPolicy: lazy +Bundle-Localization: plugin +Export-Package: org.eclipse.egit.internal.mylyn.ui;version="0.11.0";x-internal:=true, + org.eclipse.egit.internal.mylyn.ui.commit;version="0.11.0";x-internal:=true diff --git a/org.eclipse.egit.mylyn.ui/build.properties b/org.eclipse.egit.mylyn.ui/build.properties new file mode 100644 index 0000000000..0dc34f7833 --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/build.properties @@ -0,0 +1,6 @@ +source.. = src/ +output.. = bin/ +bin.includes = META-INF/,\ + .,\ + plugin.xml,\ + plugin.properties diff --git a/org.eclipse.egit.mylyn.ui/plugin.properties b/org.eclipse.egit.mylyn.ui/plugin.properties new file mode 100644 index 0000000000..1dcea67332 --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/plugin.properties @@ -0,0 +1,12 @@ +############################################################################### +# 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 +############################################################################### +Bundle-Vendor = Eclipse EGit +Bundle-Name = EGit Mylyn UI
\ No newline at end of file diff --git a/org.eclipse.egit.mylyn.ui/plugin.xml b/org.eclipse.egit.mylyn.ui/plugin.xml new file mode 100644 index 0000000000..18fa41622e --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/plugin.xml @@ -0,0 +1,10 @@ +<?xml version="1.0" encoding="UTF-8"?> +<?eclipse version="3.4"?> +<plugin> + <extension + point="org.eclipse.egit.ui.commitMessageProvider"> + <commitMessageProvider + class="org.eclipse.egit.internal.mylyn.ui.commit.MylynCommitMessageProvider"> + </commitMessageProvider> + </extension> +</plugin> diff --git a/org.eclipse.egit.mylyn.ui/pom.xml b/org.eclipse.egit.mylyn.ui/pom.xml new file mode 100644 index 0000000000..8d7653b2aa --- /dev/null +++ b/org.eclipse.egit.mylyn.ui/pom.xml @@ -0,0 +1,53 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + Copyright (C) 2011, Chris Aniszczyk <caniszczyk@gmail.com> + + 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 +--> + +<project xmlns="http://maven.apache.org/POM/4.0.0" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> + <modelVersion>4.0.0</modelVersion> + + <parent> + <groupId>org.eclipse.egit</groupId> + <artifactId>egit-parent</artifactId> + <version>0.11.0-SNAPSHOT</version> + </parent> + + <artifactId>org.eclipse.egit.mylyn.ui</artifactId> + <packaging>eclipse-plugin</packaging> + + <name>EGit Mylyn UI (Incubation)</name> + + <build> + <!-- workaround for https://issues.sonatype.org/browse/TYCHO-168 --> + <resources> + <resource> + <directory>src</directory> + <excludes> + <exclude>**/*.java</exclude> + </excludes> + </resource> + </resources> + <plugins> + <plugin> + <groupId>org.sonatype.tycho</groupId> + <artifactId>maven-osgi-source-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.codehaus.mojo</groupId> + <artifactId>findbugs-maven-plugin</artifactId> + </plugin> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-pmd-plugin</artifactId> + </plugin> + </plugins> + </build> + +</project> 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;
+ }
+
+}
|