Class LegacyResourceSupport

java.lang.Object
org.eclipse.ui.internal.LegacyResourceSupport

public final class LegacyResourceSupport extends Object
Provides access to resource-specific classes, needed to provide backwards compatibility for resource-specific functions which could not be moved up from the generic workbench layer to the IDE layer.
  • Method Details

    • getFileClass

      public static Class<?> getFileClass()
      Returns IFile.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the resources plug-in.

      Returns:
      IFile.class or null if class not available
      Since:
      3.1
    • getResourceClass

      public static Class<?> getResourceClass()
      Returns IResource.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the resources plug-in.

      Returns:
      IResource.class or null if class not available
      Since:
      3.0
    • getResourceMappingClass

      public static Class<?> getResourceMappingClass()
      Returns ResourceMapping.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the resources plug-in.

      Returns:
      ResourceMapping.class or null if class not available
      Since:
      3.1
    • getIContributorResourceAdapterClass

      public static Class<?> getIContributorResourceAdapterClass()
      Returns IContributorResourceAdapter.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the IDE plug-in.

      Returns:
      IContributorResourceAdapter.class or null if class not available
      Since:
      3.0
    • getIContributorResourceAdapter2Class

      public static Class<?> getIContributorResourceAdapter2Class()
      Returns IContributorResourceAdapter2.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the IDE plug-in.

      Returns:
      IContributorResourceAdapter.class or null if class not available
      Since:
      3.1
    • getDefaultContributorResourceAdapterClass

      public static Class<?> getDefaultContributorResourceAdapterClass()
      Returns DefaultContributorResourceAdapter.class or null if the class is not available.

      This method exists to avoid explicit references from the generic workbench to the IDE plug-in.

      Returns:
      DefaultContributorResourceAdapter.class or null if class not available
      Since:
      3.0
    • isResourceType

      public static boolean isResourceType(String objectClassName)
      Returns true if the provided type name is an IResource, and false otherwise.
      Returns:
      true if the provided type name is an IResource, and false otherwise.
      Since:
      3.1
    • isResourceMappingType

      public static boolean isResourceMappingType(String objectClassName)
      Returns true if the provided type name is an "org.eclipse.core.resources.mapping.ResourceMapping", and false otherwise.
      Returns:
      true if the provided type name is an "org.eclipse.core.resources.mapping.ResourceMapping", and false otherwise.
      Since:
      3.1
    • getAdaptedContributorResource

      public static Object getAdaptedContributorResource(Object object)
      Returns the adapted resource using the IContributorResourceAdapter registered for the given object. If the Resources plug-in is not loaded the object can not be adapted.
      Parameters:
      object - the object to adapt to IResource.
      Returns:
      returns the adapted resource using the IContributorResourceAdapter or null if the Resources plug-in is not loaded.
      Since:
      3.1
    • getAdaptedContributorResourceMapping

      public static Object getAdaptedContributorResourceMapping(Object object)
      Returns the adapted resource mapping using the IContributorResourceAdapter2 registered for the given object. If the Resources plug-in is not loaded the object can not be adapted.
      Parameters:
      object - the object to adapt to ResourceMapping.
      Returns:
      returns the adapted resource using the IContributorResourceAdapter2 or null if the Resources plug-in is not loaded.
      Since:
      3.1
    • adaptSelection

      public static IStructuredSelection adaptSelection(IStructuredSelection selection, String objectClass)
      Adapts a selection to the given objectClass considering the Legacy resource support. Non resource objectClasses are adapted using the IAdapterManager and this may load the plug-in that contributes the adapter factory.

      The returned selection will only contain elements successfully adapted.

      Parameters:
      selection - the selection to adapt
      objectClass - the class name to adapt the selection to
      Returns:
      an adapted selection
      Since:
      3.1
    • getAdapter

      public static Object getAdapter(Object element, String objectClass)
      Adapts an object to a specified objectClass considering the Legacy resource support. Non resource objectClasses are adapted using the IAdapterManager and this may load the plug-in that contributes the adapter factory.

      The returned selection will be of the same size as the original, and elements that could not be adapted are added to the returned selection as is.

      Parameters:
      element - the element to adapt
      objectClass - the class name to adapt the selection to
      Returns:
      an adapted element or null if the element could not be adapted.
      Since:
      3.1
    • getAdaptedResource

      public static Object getAdaptedResource(Object element)
      Adapt the given element to an IResource using the following search order:
      1. using the IContributorResourceAdapter registered for the given element, or
      2. directly asking the element if it adapts.
      Parameters:
      element - the element to adapt
      Returns:
      an IResource instance if the element could be adapted or null otherwise.
      Since:
      3.1
    • getAdaptedResourceMapping

      public static Object getAdaptedResourceMapping(Object element)
      Adapt the given element to an ResourceMapping using the following search order:
      1. using the IContributorResourceAdapter2 registered for the given element, or
      2. directly asking the element if it adapts.
      Parameters:
      element - the element to adapt
      Returns:
      an ResourceMapping instance if the element could be adapted or null otherwise.
      Since:
      3.1