summaryrefslogtreecommitdiffstatsabout
diff options
context:
space:
mode:
authorKevin Sawicki2011-03-23 17:12:14 (EDT)
committer Matthias Sohn2011-03-23 17:12:14 (EDT)
commit84b5ee26d3e0f6fa5befd46bb64f1028f0cf11ce (patch)
treeb05e0e3dfe2523c78479c86c1191365f892c9958
parent138477d481fa491b3e13a9f061928dfe522daddb (diff)
downloadegit-84b5ee26d3e0f6fa5befd46bb64f1028f0cf11ce.zip
egit-84b5ee26d3e0f6fa5befd46bb64f1028f0cf11ce.tar.gz
egit-84b5ee26d3e0f6fa5befd46bb64f1028f0cf11ce.tar.bz2
[historyView] Add content-type icons to History viewrefs/changes/93/2893/2
Find file name from diff file path and use editor registry to get image descriptor for that file name. This only impacts which icons are used for modified and renamed files. Bug: 340781 Change-Id: Ibfa013c484e71dbfccdbde7fba84bf471088a83b Signed-off-by: Kevin Sawicki <kevin@github.com> Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
-rw-r--r--org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java18
1 files changed, 17 insertions, 1 deletions
diff --git a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
index 009265a..07e484c 100644
--- a/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
+++ b/org.eclipse.egit.ui/src/org/eclipse/egit/ui/internal/history/FileDiffLabelProvider.java
@@ -8,7 +8,12 @@
*******************************************************************************/
package org.eclipse.egit.ui.internal.history;
+import org.eclipse.core.runtime.Path;
import org.eclipse.egit.ui.UIIcons;
+import org.eclipse.jface.resource.ImageDescriptor;
+import org.eclipse.jface.resource.JFaceResources;
+import org.eclipse.jface.resource.LocalResourceManager;
+import org.eclipse.jface.resource.ResourceManager;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
@@ -28,6 +33,9 @@ class FileDiffLabelProvider extends BaseLabelProvider implements
private Image DEFAULT = PlatformUI.getWorkbench().getSharedImages()
.getImage(ISharedImages.IMG_OBJ_FILE);
+ private ResourceManager resourceManager = new LocalResourceManager(
+ JFaceResources.getResources());
+
public String getColumnText(final Object element, final int columnIndex) {
if (columnIndex == 0) {
final FileDiff c = (FileDiff) element;
@@ -49,7 +57,14 @@ class FileDiffLabelProvider extends BaseLabelProvider implements
case RENAME:
// fall through
case MODIFY:
- return DEFAULT;
+ Image image = DEFAULT;
+ String name = new Path(c.getPath()).lastSegment();
+ if (name != null) {
+ ImageDescriptor descriptor = PlatformUI.getWorkbench()
+ .getEditorRegistry().getImageDescriptor(name);
+ image = (Image) this.resourceManager.get(descriptor);
+ }
+ return image;
}
}
return null;
@@ -57,6 +72,7 @@ class FileDiffLabelProvider extends BaseLabelProvider implements
@Override
public void dispose() {
+ this.resourceManager.dispose();
ADD.dispose();
// DELETE is shared, don't dispose
super.dispose();