/*******************************************************************************
 * Copyright (C) 2008, Shawn O. Pearce <spearce@spearce.org>
 *
 * 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
 *******************************************************************************/
package org.eclipse.egit.ui.internal.history;

import org.eclipse.egit.ui.UIIcons;
import org.eclipse.jface.viewers.BaseLabelProvider;
import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.swt.graphics.Image;
import org.eclipse.ui.ISharedImages;
import org.eclipse.ui.PlatformUI;

class FileDiffLabelProvider extends BaseLabelProvider implements
		ITableLabelProvider {
	private Image ADD = UIIcons.ELCL16_ADD.createImage();

	private Image COPY = PlatformUI.getWorkbench().getSharedImages().getImage(
			ISharedImages.IMG_TOOL_COPY);

	private Image DELETE = PlatformUI.getWorkbench().getSharedImages()
			.getImage(ISharedImages.IMG_ETOOL_DELETE);

	private Image DEFAULT = PlatformUI.getWorkbench().getSharedImages()
			.getImage(ISharedImages.IMG_OBJ_FILE);

	public String getColumnText(final Object element, final int columnIndex) {
		if (columnIndex == 0) {
			final FileDiff c = (FileDiff) element;
			return c.getPath();
		}
		return null;
	}

	public Image getColumnImage(final Object element, final int columnIndex) {
		if (columnIndex == 0) {
			final FileDiff c = (FileDiff) element;
			switch (c.getChange()) {
			case ADD:
				return ADD;
			case COPY:
				return COPY;
			case DELETE:
				return DELETE;
			case RENAME:
				// fall through
			case MODIFY:
				return DEFAULT;
			}
		}
		return null;
	}

	@Override
	public void dispose() {
		ADD.dispose();
		// DELETE is shared, don't dispose
		super.dispose();
	}

}

@@ -536,23 +536,269 @@
 pse.
-egit.ui.UIIcons
+core.runtime.Path;%0Aimport org.eclipse.egit.ui.UIIcons;%0Aimport org.eclipse.jface.resource.ImageDescriptor;%0Aimport org.eclipse.jface.resource.JFaceResources;%0Aimport org.eclipse.jface.resource.LocalResourceManager;%0Aimport org.eclipse.jface.resource.ResourceManager
 ;%0Aim
@@ -1494,16 +1494,121 @@
 FILE);%0A%0A
+%09private ResourceManager resourceManager = new LocalResourceManager(%0A%09%09%09JFaceResources.getResources());%0A%0A
 %09public 
@@ -2116,22 +2116,305 @@
 %09%09%09%09
-return DEFAULT
+Image image = DEFAULT;%0A%09%09%09%09String name = new Path(c.getPath()).lastSegment();%0A%09%09%09%09if (name != null) %7B%0A%09%09%09%09%09ImageDescriptor descriptor = PlatformUI.getWorkbench()%0A%09%09%09%09%09%09%09.getEditorRegistry().getImageDescriptor(name);%0A%09%09%09%09%09image = (Image) this.resourceManager.get(descriptor);%0A%09%09%09%09%7D%0A%09%09%09%09return image
 ;%0A%09%09
@@ -2475,16 +2475,50 @@
 ose() %7B%0A
+%09%09this.resourceManager.dispose();%0A
 %09%09ADD.di

Add content-type icons to History view