summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorRobin Stocker2011-05-21 19:10:39 (EDT)
committer Matthias Sohn2011-05-21 19:10:39 (EDT)
commit19f2cf44d7868aa2d4b5faa811af5dbbc9600a12 (patch)
tree4f6f96e74e1977c8bf030f4c9926e4ac0a105266
parenta24f0036257215a848844e5170cda0ef5660e8ec (diff)
downloadegit-19f2cf44d7868aa2d4b5faa811af5dbbc9600a12.zip
egit-19f2cf44d7868aa2d4b5faa811af5dbbc9600a12.tar.gz
egit-19f2cf44d7868aa2d4b5faa811af5dbbc9600a12.tar.bz2
Use CompareUtils.compareHeadWithWorkspacerefs/changes/87/3487/2
This was introduced with Iec2c848f9da6b00eb34c5376627dd529b2815c88. Change-Id: Ie870b0ae19f8c85b2ae318838c8b4dd106daabb8 Signed-off-by: Robin Stocker <robin@nibor.org> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithHeadActionHandler.java32
1 files changed, 2 insertions, 30 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithHeadActionHandler.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithHeadActionHandler.java
index c823c5f..c8a3d99 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithHeadActionHandler.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/actions/CompareWithHeadActionHandler.java
@@ -10,23 +10,15 @@ package org.eclipse.egit.ui.internal.actions;
import java.io.IOException;
-import org.eclipse.compare.CompareUI;
-import org.eclipse.compare.ITypedElement;
import org.eclipse.core.commands.ExecutionEvent;
import org.eclipse.core.commands.ExecutionException;
import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IResource;
-import org.eclipse.egit.core.project.RepositoryMapping;
import org.eclipse.egit.ui.Activator;
import org.eclipse.egit.ui.internal.CompareUtils;
-import org.eclipse.egit.ui.internal.GitCompareFileRevisionEditorInput;
import org.eclipse.egit.ui.internal.dialogs.CompareTreeView;
import org.eclipse.jgit.lib.Constants;
-import org.eclipse.jgit.lib.Ref;
import org.eclipse.jgit.lib.Repository;
-import org.eclipse.jgit.revwalk.RevCommit;
-import org.eclipse.jgit.revwalk.RevWalk;
-import org.eclipse.team.ui.synchronize.SaveableCompareEditorInput;
import org.eclipse.ui.PartInitException;
import org.eclipse.ui.PlatformUI;
@@ -43,28 +35,8 @@ public class CompareWithHeadActionHandler extends RepositoryActionHandler {
final IResource[] resources = getSelectedResources(event);
if (resources.length == 1 && resources[0] instanceof IFile) {
- final IFile baseFile = (IFile) resources[0];
- final String gitPath = RepositoryMapping.getMapping(
- baseFile.getProject()).getRepoRelativePath(baseFile);
- final ITypedElement base = SaveableCompareEditorInput
- .createFileElement(baseFile);
-
- ITypedElement next;
- try {
- Ref head = repository.getRef(Constants.HEAD);
- RevWalk rw = new RevWalk(repository);
- RevCommit commit = rw.parseCommit(head.getObjectId());
-
- next = CompareUtils.getFileRevisionTypedElement(gitPath,
- commit, repository);
- } catch (IOException e) {
- Activator.handleError(e.getMessage(), e, true);
- return null;
- }
-
- final GitCompareFileRevisionEditorInput in = new GitCompareFileRevisionEditorInput(
- base, next, null);
- CompareUI.openCompareEditor(in);
+ final IFile file = (IFile) resources[0];
+ CompareUtils.compareHeadWithWorkspace(repository, file);
return null;
} else {