Class CommonPlugin

All Implemented Interfaces:
Logger, ResourceLocator

public final class CommonPlugin extends EMFPlugin
The Plugin for the model EMF.Common library. EMF must run within an Eclipse workbench, within a headless Eclipse workspace, or just stand-alone as part of some other application. To support this, all resource access should be directed to the resource locator, which can redirect the service as appropriate to the runtime. During stand-alone invocation no plugin initialization takes place. In this case, common.resources.jar must be on the CLASSPATH.
See Also:
  • Field Details

    • INSTANCE

      public static final CommonPlugin INSTANCE
      The singleton instance of the plugin.
  • Method Details

    • getPluginResourceLocator

      public ResourceLocator getPluginResourceLocator()
      Description copied from class: EMFPlugin
      Returns an Eclipse plugin implementation of a resource locator.
      Specified by:
      getPluginResourceLocator in class EMFPlugin
      Returns:
      an Eclipse plugin implementation of a resource locator.
    • getPlugin

      public static CommonPlugin.Implementation getPlugin()
      Returns the singleton instance of the Eclipse plugin.
      Returns:
      the singleton instance.
    • asLocalURI

      public static URI asLocalURI(URI uri)
      Use the platform, if available, to convert to a local URI.
    • resolve

      public static URI resolve(URI uri)
      Use the platform, if available, to resolve the URI.
    • loadClass

      public static Class<?> loadClass(String pluginID, String className) throws ClassNotFoundException
      Use the platform, if available, to load the named class using the right class loader.
      Throws:
      ClassNotFoundException
    • getTargetPlatformExtensionPoints

      public static Map<String,List<CommonPlugin.ElementRecord>> getTargetPlatformExtensionPoints(Set<String> extensionPoints)
      Computes a list of element records for each requested extension point. Each key in the map is extension point ID.

      The corresponding value is a list of the extension point element records associated with that extension point.

      Each root element record has synthetic attributes derived from the extension point:

      point
      The extension point ID itself.
      symbolicName
      The symbolic name of the bundle that contains the extension point.
      location
      The root location URI the bundle containing the extension point. For example, platform:/resource/org.example.plugin for an extension point in the workspace, file:/folder/org.eclipse.plugin for folder bundle in the target platform, or archive:file:/file/folder/org.example.plugin.jar!/ for a jarred bundle in the target platform. This is useful for resolving a relative path in attribute value to its absolute path in the bundle.

      This method uses the Plug-in Development Environment (PDE) to compute the results. It will include results for plug-ins in the workspace as well as for plug-ins in the target platform. If PDE is not available, this information cannot be computed.

      Parameters:
      extensionPoints - a set of extension points to query; if it's null or empty, all extension points will be queried.
      Returns:
      a map of extension point data, or null if PDE is not available.
      Since:
      2.14
    • getTargetPlatformBundleMappings

      public static Map<String,URI> getTargetPlatformBundleMappings()
      Computes a map from bundle symbolic name to the bundle's location URI.

      This method uses the Plug-in Development Environment (PDE) to compute the results. It will include results for plug-ins in the workspace as well as for plug-ins in the target platform. If PDE is not available, this information cannot be computed.

      Returns:
      a map from bundle symbolic name to the bundle's location URI, or null if PDE is not available.
      Since:
      2.14
    • getComparator

      public Comparator<String> getComparator()
      Returns a string comparator appropriate for collating strings for the current locale.
      Returns:
      a string comparator appropriate for collating strings for the current locale.
    • getComparator

      public Comparator<String> getComparator(Locale locale)
      Returns a string comparator appropriate for collating strings for the give locale. This will use ICU, when available that plug-in is available, or Collator otherwise.
      Parameters:
      locale - the locale for which a comparator is needed.
      Returns:
      a string comparator appropriate for collating strings for the give locale.