Bug 22329 Incorrect icon shown for jar entries [package explorer] [browsing]
The icon displayed for jar file entries is not always correct. I am supplying the following to demonstrate the problem: 1. test.plugin.zip - This is a plugin that defines several default text editors with unique icons for particular file names. Extract it into the eclipse/plugins directory. 2. IconJarTest.zip - This is a sample project which can be unzipped into your workspace directory. When you look at the project, you will see that the abc.xml and def.xml files in the MyFiles folder have unique icons (as defined by the plugin). However, if you expand the iconTest.jar file, def.xml has the same icon as abc.xml. If you open the two files in the jar though, the icon displayed in the editor tab is actually correct. I have seen a case where the editor tab icons are incorrect (a generic file icon appears rather than either of the specific icons), but have yet to be able to reproduce that particular problem.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/viewsupport/StorageLabelProvider.java
/*
 * (c) Copyright IBM Corp. 2000, 2001.
 * All Rights Reserved.
 */
package org.eclipse.jdt.internal.ui.viewsupport;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
import org.eclipse.core.resources.IStorage;
import org.eclipse.swt.graphics.Image;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.ui.IEditorRegistry;
import org.eclipse.ui.PlatformUI;
/**
 * Standard label provider for IStorage objects.
 * Use this class when you want to present IStorage objects in a viewer.
 */
public class StorageLabelProvider extends LabelProvider {