Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorTomasz Zarna2008-02-28 16:47:01 +0000
committerTomasz Zarna2008-02-28 16:47:01 +0000
commitc1db179fbfa25723a0c0505551d9379e6b2db0a0 (patch)
treec445f4182a86f96ce00c31b2ea06dd2fa32b1e57 /bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
parent4b6d3e80800bc744920f87d78464b2ad73891707 (diff)
downloadeclipse.platform.team-c1db179fbfa25723a0c0505551d9379e6b2db0a0.tar.gz
eclipse.platform.team-c1db179fbfa25723a0c0505551d9379e6b2db0a0.tar.xz
eclipse.platform.team-c1db179fbfa25723a0c0505551d9379e6b2db0a0.zip
bug 217070: [Apply Patch] Show matched hunks in Apply Patch wizard
Diffstat (limited to 'bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java')
-rw-r--r--bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java20
1 files changed, 14 insertions, 6 deletions
diff --git a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
index 5aef41155..de3414230 100644
--- a/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
+++ b/bundles/org.eclipse.compare/compare/org/eclipse/compare/internal/patch/HunkTypedElement.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2006, 2007 IBM Corporation and others.
+ * Copyright (c) 2006, 2008 IBM Corporation 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
@@ -37,15 +37,21 @@ public class HunkTypedElement implements ITypedElement, IEncodedStreamContentAcc
* @see org.eclipse.compare.ITypedElement#getImage()
*/
public Image getImage() {
+ LocalResourceManager imageCache = PatchCompareEditorInput.getImageCache(fHunkResult.getDiffResult().getConfiguration());
+ ImageDescriptor imageDesc = CompareUIPlugin.getImageDescriptor(ICompareUIConstants.HUNK_OBJ);
+ Image image = imageCache.createImage(imageDesc);
if (!fHunkResult.isOK()) {
- LocalResourceManager imageCache = PatchCompareEditorInput.getImageCache(fHunkResult.getDiffResult().getConfiguration());
- return getHunkErrorImage(null, imageCache, false);
- }
- return null;
+ return getHunkErrorImage(image, imageCache, true);
+ }
+ return image;
}
public static Image getHunkErrorImage(Image baseImage, LocalResourceManager imageCache, boolean onLeft) {
- ImageDescriptor desc = new DiffImageDescriptor(baseImage, CompareUIPlugin.getImageDescriptor(ICompareUIConstants.ERROR_OVERLAY), ICompareUIConstants.COMPARE_IMAGE_WIDTH, onLeft);
+ return getHunkOverlayImage(baseImage, imageCache, ICompareUIConstants.ERROR_OVERLAY, onLeft);
+ }
+
+ private static Image getHunkOverlayImage(Image baseImage, LocalResourceManager imageCache, String path, boolean onLeft) {
+ ImageDescriptor desc = new DiffImageDescriptor(baseImage, CompareUIPlugin.getImageDescriptor(path), ICompareUIConstants.COMPARE_IMAGE_WIDTH, onLeft);
Image image = imageCache.createImage(desc);
return image;
}
@@ -91,6 +97,8 @@ public class HunkTypedElement implements ITypedElement, IEncodedStreamContentAcc
public Object getAdapter(Class adapter) {
if (adapter == IHunk.class)
return fHunkResult;
+ if (adapter == HunkResult.class)
+ return fHunkResult;
return Platform.getAdapterManager().getAdapter(this, adapter);
}

Back to the top