In working on my company’s product I saw that the correct icons were appearing when the product was run in Ganymede, but not Galileo. The problem is captured in bug 295803 and has to do with the selection of the Navigator Content Extension (NCE) to provide the label when there are two NCEs that operate on the same content. In my applications case, it was my app’s NCE and the NCE that takes care of resources. In Ganymede, the higher priority of these NCEs has the first opportunity to provide the labels, but in Galileo, it’s the opposite, the lowest priority provides the labels, which is certainly not what you want.
I think we should address the above bug in 3.5.2, as it’s a bad incompatible change.
Here is the (amazingly pretty and elegant) code that I used to work around the problem:
/*
* Yum. Due to Eclipse bug 295803 we need to change the priority of the
* NCE for our product. This only needs to happen on a 3.5.0 or 3.5.1
* system. We sense this by the org.eclipse.ui.navigator bundle version
* (in which the minor version lags one behind the main Eclipse
* version.) Note that if this bug is fixed in 3.5.2, then the version
* check needs to consider only CNF versions 3.4.0 and 3.4.1.
*/
Bundle bundle = Platform.getBundle("org.eclipse.ui.navigator"); //$NON-NLS-1$
Dictionary headers = bundle.getHeaders();
String version = (String)headers.get("Bundle-Version"); //$NON-NLS-1$
if (version.startsWith("3.4")) //$NON-NLS-1$
{
INavigatorContentService ncs = getNavigator()
.getNavigatorContentService();
NavigatorContentDescriptor desc = (NavigatorContentDescriptor)ncs
.getContentDescriptorById("com.oaklandsw.transform.navigatorContent"); //$NON-NLS-1$
try
{
Field[] fields = desc.getClass().getDeclaredFields();
for (int i = 0; i < fields.length; i++)
{
if (fields[i].getName().equals("priority")) //$NON-NLS-1$
{
fields[i].setAccessible(true);
fields[i]
.set(desc,
new Integer(Priority.LOWEST_PRIORITY_VALUE));
break;
}
}
}
catch (Exception e)
{
Util.impossible(e);
}
}