bug 392678: [api] Provide API to show the details of a commit
Added an default no-op implementation for the ScmConnectorUi and a EGit
specific implementation
Task-Url: https://bugs.eclipse.org/bugs/show_bug.cgi?id=392678
Change-Id: Ibe45b91a6afe7d21c51c865a427d6d0463f67649
diff --git a/org.eclipse.mylyn.cvs.core/.classpath b/org.eclipse.mylyn.cvs.core/.classpath
index 121e527..baca2e6 100644
--- a/org.eclipse.mylyn.cvs.core/.classpath
+++ b/org.eclipse.mylyn.cvs.core/.classpath
@@ -2,6 +2,10 @@
<classpath>
<classpathentry kind="src" path="src"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/core/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.mylyn.git.core/.classpath b/org.eclipse.mylyn.git.core/.classpath
index ad32c83..b463df6 100644
--- a/org.eclipse.mylyn.git.core/.classpath
+++ b/org.eclipse.mylyn.git.core/.classpath
@@ -1,7 +1,11 @@
<?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/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/core/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.mylyn.git.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.git.core/META-INF/MANIFEST.MF
index 3fb8989..469a6b7 100644
--- a/org.eclipse.mylyn.git.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.git.core/META-INF/MANIFEST.MF
@@ -12,7 +12,7 @@
org.eclipse.core.runtime,
org.eclipse.core.filesystem,
com.google.guava;bundle-version="10.0.1"
-Export-Package: org.eclipse.mylyn.internal.git.core;x-internal:=true
+Export-Package: org.eclipse.mylyn.internal.git.core;x-friends:="org.eclipse.mylyn.git.ui"
Bundle-Vendor: %Bundle-Vendor
Bundle-Localization: plugin
Bundle-ActivationPolicy: lazy
diff --git a/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitConnector.java b/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitConnector.java
index d29b365..b2446c8 100644
--- a/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitConnector.java
+++ b/org.eclipse.mylyn.git.core/src/org/eclipse/mylyn/internal/git/core/GitConnector.java
@@ -126,15 +126,11 @@
try {
RevCommit commit;
commit = walk.parseCommit(ObjectId.fromString(revision.getContentIdentifier()));
- List<Change> changes = diffCommit(repository, repository2, walk, commit);
-
+ //diffCommit(repository, repository2, walk, commit);
return changeSet(commit, gitRepository);
-
} catch (Exception e) {
- e.printStackTrace();
throw new CoreException(new Status(IStatus.ERROR, GitConnector.PLUGIN_ID, e.getMessage()));
}
-
}
List<Change> diffCommit(ScmRepository repository, Repository repository2, RevWalk walk, RevCommit commit)
diff --git a/org.eclipse.mylyn.git.ui/.classpath b/org.eclipse.mylyn.git.ui/.classpath
index ad32c83..8878555 100644
--- a/org.eclipse.mylyn.git.ui/.classpath
+++ b/org.eclipse.mylyn.git.ui/.classpath
@@ -1,7 +1,12 @@
<?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/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/core/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/ui/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF b/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
index 9583864..2b77815 100644
--- a/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.git.ui/META-INF/MANIFEST.MF
@@ -12,7 +12,10 @@
org.eclipse.ui.forms,
org.eclipse.mylyn.versions.ui,
org.eclipse.mylyn.commons.core;bundle-version="3.8.0",
- org.eclipse.egit.core;bundle-version="0.10.0"
+ org.eclipse.egit.core,
+ org.eclipse.egit.ui,
+ org.eclipse.mylyn.git.core,
+ org.eclipse.jgit
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-Localization: plugin
diff --git a/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java b/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
index 0136bc2..6866ef9 100644
--- a/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
+++ b/org.eclipse.mylyn.git.ui/src/org/eclipse/mylyn/internal/git/ui/connector/GitConnectorUi.java
@@ -1,11 +1,11 @@
/*******************************************************************************
* Copyright (c) 2011 Ericsson Research Canada 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:
* Ericsson - Initial API and implementation
*******************************************************************************/
@@ -15,7 +15,14 @@
import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.Assert;
import org.eclipse.egit.core.GitProvider;
+import org.eclipse.egit.ui.internal.commit.CommitEditor;
+import org.eclipse.egit.ui.internal.commit.RepositoryCommit;
import org.eclipse.jface.window.Window;
+import org.eclipse.jgit.lib.ObjectId;
+import org.eclipse.jgit.lib.Repository;
+import org.eclipse.jgit.revwalk.RevCommit;
+import org.eclipse.jgit.revwalk.RevWalk;
+import org.eclipse.mylyn.internal.git.core.GitRepository;
import org.eclipse.mylyn.internal.git.ui.GetChangeSetDialog;
import org.eclipse.mylyn.versions.core.ChangeSet;
import org.eclipse.mylyn.versions.core.ScmCore;
@@ -56,4 +63,25 @@
return null;
}
+ @Override
+ public void showChangeSetInView(ChangeSet cs) {
+ String objectId = cs.getId();
+ GitRepository repo = (GitRepository) cs.getRepository();
+ Repository repository = repo.getRepository();
+ CommitEditor.openQuiet(new RepositoryCommit(repository, getCommit(repository, objectId)));
+ }
+
+ private RevCommit getCommit(Repository repository, String objectId) {
+ RevWalk revWalk = null;
+ try {
+ revWalk = new RevWalk(repository);
+ return revWalk.parseCommit(ObjectId.fromString(objectId));
+ } catch (Exception e) {
+ return null;
+ } finally {
+ if (revWalk != null) {
+ revWalk.release();
+ }
+ }
+ }
}
diff --git a/org.eclipse.mylyn.subclipse.ui/.classpath b/org.eclipse.mylyn.subclipse.ui/.classpath
index ad32c83..8878555 100644
--- a/org.eclipse.mylyn.subclipse.ui/.classpath
+++ b/org.eclipse.mylyn.subclipse.ui/.classpath
@@ -1,7 +1,12 @@
<?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/JavaSE-1.6"/>
- <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins"/>
+ <classpathentry kind="con" path="org.eclipse.pde.core.requiredPlugins">
+ <accessrules>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/core/**"/>
+ <accessrule kind="accessible" pattern="org/eclipse/mylyn/versions/ui/**"/>
+ </accessrules>
+ </classpathentry>
<classpathentry kind="src" path="src"/>
<classpathentry kind="output" path="bin"/>
</classpath>
diff --git a/org.eclipse.mylyn.versions.core/META-INF/MANIFEST.MF b/org.eclipse.mylyn.versions.core/META-INF/MANIFEST.MF
index 0423102..d75b6f3 100644
--- a/org.eclipse.mylyn.versions.core/META-INF/MANIFEST.MF
+++ b/org.eclipse.mylyn.versions.core/META-INF/MANIFEST.MF
@@ -13,6 +13,6 @@
org.eclipse.team.core,
org.eclipse.mylyn.commons.core;bundle-version="3.8.0"
Bundle-ActivationPolicy: lazy
-Export-Package: org.eclipse.mylyn.internal.versions.core;x-internal:=true,
- org.eclipse.mylyn.versions.core;x-internal:=true,
- org.eclipse.mylyn.versions.core.spi;x-internal:=true
+Export-Package: org.eclipse.mylyn.internal.versions.core;x-friends:="org.eclipse.mylyn.versions.ui",
+ org.eclipse.mylyn.versions.core;x-friends:="org.eclipse.mylyn.versions.ui",
+ org.eclipse.mylyn.versions.core.spi;x-friends:="org.eclipse.mylyn.versions.ui"
diff --git a/org.eclipse.mylyn.versions.ui/src/org/eclipse/mylyn/versions/ui/spi/ScmConnectorUi.java b/org.eclipse.mylyn.versions.ui/src/org/eclipse/mylyn/versions/ui/spi/ScmConnectorUi.java
index 8b03074..3a58a9b 100644
--- a/org.eclipse.mylyn.versions.ui/src/org/eclipse/mylyn/versions/ui/spi/ScmConnectorUi.java
+++ b/org.eclipse.mylyn.versions.ui/src/org/eclipse/mylyn/versions/ui/spi/ScmConnectorUi.java
@@ -4,9 +4,10 @@
* 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:
* Ericsson - Initial API and Implementation
+ * Kilian Matt (Research Group for Industrial Software (INSO), Vienna University of Technology) - improvements
*******************************************************************************/
package org.eclipse.mylyn.versions.ui.spi;
@@ -19,19 +20,33 @@
* Provides an interface intended to be associated with a UI, so the user can select available version control artifacts
*
* @author Alvaro Sanchez-Leon
+ * @author Kilian Matt
*/
public abstract class ScmConnectorUi {
+
/**
- * Resolve change sets for a given repository and narrow down the selection possibilities to the ones related to the
- * given resource provided. This method is suitable to open a UI Wizard, the selection is expected to be driven by
- * the user.
+ * Resolves change sets for a given repository and narrow down the selection possibilities to the ones related to
+ * the given resource provided. This method is suitable to open a UI Wizard, the selection is expected to be driven
+ * by the user.
*
* @param repository
- * - Associated repository
+ * associated repository
* @param resource
- * - work space resource e.g. project used to narrow down the change set options presented to the user
- * @return ChnageSet - user selection
+ * work space resource e.g. project used to narrow down the change set options presented to the user
+ * @return the selected change set
*/
public abstract ChangeSet getChangeSet(ScmRepository repository, IResource resource);
+ /**
+ * Display a changesets in a connector specific view.
+ * <p>
+ * Throws {@link UnsupportedOperationException} by default.
+ *
+ * @param changeSet
+ * the changeset to display
+ */
+ public void showChangeSetInView(ChangeSet changeSet) {
+ throw new UnsupportedOperationException();
+ }
+
}