Search code examples
eclipse-plugineclipse-rcp

Is there a way to find where the internal classes are moved


We are migrating our application from Eclipse Indigo to Photon and I need help find a solution or alternate for a particular class which is present in Indigo but not in Photon.

The class we are trying to figure out is org.eclipse.ui.internal.navigator.AdaptabilityUtility. Since it is an Internal class it is not available. But we had no luck finding an alternate.

Only one function of the class is used :

IAdaptable openable = (IAdaptable) AdaptabilityUtility.getAdapter(
        selection.getFirstElement(), IResource.class);

If someone knows an alternative method which can be used here, it will be a great help.


Solution

  • Eclipse internals were completely rewritten for Eclipse 4 so in general there may not be exact alternatives for internal classes which were never part of the official API.

    However for AdaptabilityUtility it looks like the current org.eclipse.core.runtime.Adapters class should work:

    IResource resource = Adapters.adapt(selection.getFirstElement(), IResource.class);
    

    Adapters.adapt uses generics so casts are not needed. Adapters is not internal so it is an official API.