An incompatibility between Ganymede and Galileo

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);
            }
        }

Advertisements

About francisu

VP, Architecture at Talend, overall responsible for product architecture and governance. Also maintainer of the Jenkins EC2 plugin.
This entry was posted in Common Navigator. Bookmark the permalink.

One Response to An incompatibility between Ganymede and Galileo

  1. andyroots says:

    Hi Fancis,

    I’m new in RCP Applications and I have the same problem using the CNF in a gmf – created graphical editor . My question is : “where do i have to put the code to solve this problem?”

    Thanx a lot for any advice
    andy

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s