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.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classPluginRegistry.PluginFilterFilter used when searching for plug-in models.
-
Constructor Summary
Constructors Constructor Description PluginRegistry()
-
Method Summary
All Methods Static Methods Concrete Methods Modifier and Type Method Description static IBuildModelcreateBuildModel(IPluginModelBase model)Creates and returns a model associated with thebuild.propertiesof a bundle in the workspace ornullif none.static ModelEntryfindEntry(String id)Returns a model entry containing all workspace and target plug-ins by the given IDstatic IPluginModelBasefindModel(String id)Returns the plug-in model for the best match plug-in with the given ID.static IPluginModelBasefindModel(String id, String version, int match, PluginRegistry.PluginFilter filter)Returns a model matching the given id, version, match rule, and optional filter, ornullif none.static IPluginModelBasefindModel(String id, VersionRange range, PluginRegistry.PluginFilter filter)Returns a model matching the given id, version range, and optional filter, ornullif none.static IPluginModelBasefindModel(IProject project)Returns the plug-in model corresponding to the given project, ornullif the project does not represent a plug-in project or if it contains a manifest file that is malformed or missing vital information.static IPluginModelBasefindModel(BundleDescription desc)Returns a plug-in model associated with the given bundle descriptionstatic IPluginModelBase[]findModels(String id, String version, int match, PluginRegistry.PluginFilter filter)Returns all models matching the given id, version, match rule, and optional filter.static IPluginModelBase[]findModels(String id, VersionRange range, PluginRegistry.PluginFilter filter)Returns all models matching the given id, version range, and optional filter.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.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.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.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.static IPluginModelBase[]getExternalModels()Return the model manager that keeps track of plug-ins in the target platformstatic IPluginModelBase[]getWorkspaceModels()Returns all plug-in models in the workspace
-
-
-
Method Detail
-
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, ornullif 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
nullif the project is not a plug-in project
-
findModel
public static IPluginModelBase findModel(BundleDescription desc)
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
nullif none exists
-
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
includeFragmentsis 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
includeFragmentsis 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, ornullif none. p> 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 findversion- minimum version, ornullto only match on symbolic namematch- one ofIMatchRules.COMPATIBLE,IMatchRules.EQUIVALENT,IMatchRules.GREATER_OR_EQUAL,IMatchRules.PERFECT, orIMatchRules.NONEwhen a version is unspecifiedfilter- a plug-in filter ornull- 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 findversion- minimum version, ornullto only match on symbolic namematch- one ofIMatchRules.COMPATIBLE,IMatchRules.EQUIVALENT,IMatchRules.GREATER_OR_EQUAL,IMatchRules.PERFECT, orIMatchRules.NONEwhen a version is unspecifiedfilter- a plug-in filter ornull- 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, ornullif 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 findrange- acceptable version range to match, ornullfor any rangefilter- a plug-in filter ornull- 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 findrange- acceptable version range to match, ornullfor any rangefilter- a plug-in filter ornull- 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 thebuild.propertiesof a bundle in the workspace ornullif none.- Parameters:
model- plug-in model base- Returns:
- a build model initialized from the plug-in's
build.propertiesornullif none. Returnsnullfor 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
-
-