Class PluginRegistry

java.lang.Object
org.eclipse.pde.core.plugin.PluginRegistry

public class PluginRegistry extends Object
The central access point for models representing plug-ins found in the workspace and in the target platform.

This class provides static methods only; it is not intended to be instantiated or subclassed by clients.

Since:
3.3
Restriction:
This class is not intended to be subclassed by clients.
Restriction:
This class is not intended to be instantiated by clients.
  • Constructor Details

    • PluginRegistry

      public PluginRegistry()
  • Method Details

    • findEntry

      public static ModelEntry findEntry(String id)
      Returns a model entry containing all workspace and target plug-ins by the given ID
      Parameters:
      id - the plug-in ID
      Returns:
      a model entry containing all workspace and target plug-ins by the given ID
    • findModel

      public static IPluginModelBase findModel(String id)
      Returns the plug-in model for the best match plug-in with the given ID. A null value is returned if no such bundle is found in the workspace or target platform.

      A workspace plug-in is always preferably returned over a target plug-in. A plug-in that is checked/enabled on the Target Platform preference page is always preferably returned over a target plug-in that is unchecked/disabled.

      In the case of a tie among workspace plug-ins or among target plug-ins, the plug-in with the highest version is returned.

      In the case of a tie among more than one suitable plug-in that have the same version, one of those plug-ins is randomly returned.

      Parameters:
      id - the plug-in ID
      Returns:
      the plug-in model for the best match plug-in with the given ID
    • findModel

      public static IPluginModelBase findModel(IProject project)
      Returns the plug-in model corresponding to the given project, or null if the project does not represent a plug-in project or if it contains a manifest file that is malformed or missing vital information.
      Parameters:
      project - the project
      Returns:
      a plug-in model corresponding to the project or null if the project is not a plug-in project
    • findModel

      @Deprecated(forRemoval=true) public static IPluginModelBase findModel(BundleDescription desc)
      Deprecated, for removal: This API element is subject to removal in a future version.
      Returns a plug-in model associated with the given bundle description
      Parameters:
      desc - the bundle description
      Returns:
      a plug-in model associated with the given bundle description or null if none exists
    • findModel

      public static IPluginModelBase findModel(Resource resource)
      Returns a plug-in model associated with the given resource
      Parameters:
      resource - the (OSGi) resource to find a model for
      Returns:
      a plug-in model associated with the given bundle description or null if none exists
      Since:
      3.18
    • getActiveModels

      public static IPluginModelBase[] getActiveModels()
      Returns all plug-ins and fragments in the workspace as well as all plug-ins and fragments that are checked on the Target Platform preference page.

      If a workspace plug-in/fragment has the same ID as a target plug-in/fragment, the target counterpart is skipped and not included.

      Equivalent to getActiveModels(true)

      Returns:
      all plug-ins and fragments in the workspace as well as all plug-ins and fragments that are checked on the Target Platform preference page.
    • getActiveModels

      public static IPluginModelBase[] getActiveModels(boolean includeFragments)
      Returns all plug-ins and (possibly) fragments in the workspace as well as all plug-ins and (possibly) fragments that are checked on the Target Platform preference page.

      If a workspace plug-in/fragment has the same ID as a target plug-in, the target counterpart is skipped and not included.

      The returned result includes fragments only if includeFragments is set to true

      Parameters:
      includeFragments - a boolean indicating if fragments are desired in the returned result
      Returns:
      all plug-ins and (possibly) fragments in the workspace as well as all plug-ins and (possibly) fragments that are checked on the Target Platform preference page.
    • getAllModels

      public static IPluginModelBase[] getAllModels()
      Returns all plug-ins and fragments in the workspace as well as all target plug-ins and fragments, regardless whether or not they are checked or not on the Target Platform preference page.

      If a workspace plug-in/fragment has the same ID as a target plug-in, the target counterpart is skipped and not included.

      Equivalent to getAllModels(true)

      Returns:
      all plug-ins and fragments in the workspace as well as all target plug-ins and fragments, regardless whether or not they are checked on the Target Platform preference page.
    • getAllModels

      public static IPluginModelBase[] getAllModels(boolean includeFragments)
      Returns all plug-ins and (possibly) fragments in the workspace as well as all plug-ins and (possibly) fragments, regardless whether or not they are checked on the Target Platform preference page.

      If a workspace plug-in/fragment has the same ID as a target plug-in/fragment, the target counterpart is skipped and not included.

      The returned result includes fragments only if includeFragments is set to true

      Parameters:
      includeFragments - a boolean indicating if fragments are desired in the returned result
      Returns:
      ll plug-ins and (possibly) fragments in the workspace as well as all plug-ins and (possibly) fragments, regardless whether or not they are checked on the Target Platform preference page.
    • getWorkspaceModels

      public static IPluginModelBase[] getWorkspaceModels()
      Returns all plug-in models in the workspace
      Returns:
      all plug-in models in the workspace
    • getExternalModels

      public static IPluginModelBase[] getExternalModels()
      Return the model manager that keeps track of plug-ins in the target platform
      Returns:
      the model manager that keeps track of plug-ins in the target platform
    • findModel

      public static IPluginModelBase findModel(String id, String version, int match, PluginRegistry.PluginFilter filter)
      Returns a model matching the given id, version, match rule, and optional filter, or null if none.

      A workspace plug-in is always preferably returned over a target plug-in. A plug-in that is checked/enabled on the Target Platform preference page is always preferably returned over a target plug-in that is unchecked/disabled.

      In the case of a tie among workspace plug-ins or among target plug-ins, the plug-in with the highest version is returned.

      In the case of a tie among more than one suitable plug-in that have the same version, one of those plug-ins is randomly returned.

      Parameters:
      id - symbolic name of a plug-in to find
      version - minimum version, or null to only match on symbolic name
      match - one of IMatchRules.COMPATIBLE, IMatchRules.EQUIVALENT, IMatchRules.GREATER_OR_EQUAL, IMatchRules.PERFECT, or IMatchRules.NONE when a version is unspecified
      filter - a plug-in filter or null
      Returns:
      a matching model or null
      Since:
      3.6
    • findModels

      public static IPluginModelBase[] findModels(String id, String version, int match, PluginRegistry.PluginFilter filter)
      Returns all models matching the given id, version, match rule, and optional filter.

      Target (external) plug-ins/fragments with the same ID as workspace counterparts are not considered.

      Returns plug-ins regardless of whether they are checked/enabled or unchecked/disabled on the Target Platform preference page.

      Parameters:
      id - symbolic name of a plug-ins to find
      version - minimum version, or null to only match on symbolic name
      match - one of IMatchRules.COMPATIBLE, IMatchRules.EQUIVALENT, IMatchRules.GREATER_OR_EQUAL, IMatchRules.PERFECT, or IMatchRules.NONE when a version is unspecified
      filter - a plug-in filter or null
      Returns:
      a matching models, possibly an empty collection
      Since:
      3.6
    • findModel

      public static IPluginModelBase findModel(String id, VersionRange range, PluginRegistry.PluginFilter filter)
      Returns a model matching the given id, version range, and optional filter, or null if none.

      A workspace plug-in is always preferably returned over a target plug-in. A plug-in that is checked/enabled on the Target Platform preference page is always preferably returned over a target plug-in that is unchecked/disabled.

      In the case of a tie among workspace plug-ins or among target plug-ins, the plug-in with the highest version is returned.

      In the case of a tie among more than one suitable plug-in that have the same version, one of those plug-ins is randomly returned.

      Parameters:
      id - symbolic name of plug-in to find
      range - acceptable version range to match, or null for any range
      filter - a plug-in filter or null
      Returns:
      a matching model or null
      Since:
      3.6
    • findModels

      public static IPluginModelBase[] findModels(String id, VersionRange range, PluginRegistry.PluginFilter filter)
      Returns all models matching the given id, version range, and optional filter.

      Target (external) plug-ins/fragments with the same ID as workspace counterparts are not considered.

      Returns plug-ins regardless of whether they are checked/enabled or unchecked/disabled on the Target Platform preference page.

      Parameters:
      id - symbolic name of plug-ins to find
      range - acceptable version range to match, or null for any range
      filter - a plug-in filter or null
      Returns:
      a matching models, possibly empty
      Since:
      3.6
    • createBuildModel

      public static IBuildModel createBuildModel(IPluginModelBase model) throws CoreException
      Creates and returns a model associated with the build.properties of a bundle in the workspace or null if none.
      Parameters:
      model - plug-in model base
      Returns:
      a build model initialized from the plug-in's build.properties or null if none. Returns null for external plug-in models (i.e. models that are not based on workspace projects).
      Throws:
      CoreException - if unable to create a build model
      Since:
      3.7