Eclipse Platform
2.0

org.eclipse.core.runtime.model
Class PluginRegistryModel

java.lang.Object
  |
  +--org.eclipse.core.runtime.model.PluginRegistryModel

public class PluginRegistryModel
extends Object

A container for a collection of plug-in descriptors.

This class may be instantiated, or further subclassed.


Constructor Summary
PluginRegistryModel()
          Creates a new plug-in registry model which contains no plug-ins.
 
Method Summary
 void addFragment(PluginFragmentModel fragment)
          Adds the specified plug-in fragment to this registry.
 void addPlugin(PluginDescriptorModel plugin)
          Adds the specified plug-in to this registry.
protected  void assertIsWriteable()
          Checks that this model object is writeable.
 PluginFragmentModel getFragment(String id)
          Returns the plug-in fragment with the given identifier in this plug-in registry, or null if there is no such fragment.
 PluginFragmentModel getFragment(String id, String version)
          Returns the identified plug-in fragment or null if the fragment does not exist.
 PluginFragmentModel[] getFragments()
          Returns the list of plug-in fragments managed by this registry.
 PluginFragmentModel[] getFragments(String id)
          Returns all versions of the identified plug-in fragment known to this plug-in registry.
 PluginDescriptorModel getPlugin(String pluginId)
          Returns the plug-in descriptor with the given plug-in identifier in this plug-in registry, or null if there is no such plug-in.
 PluginDescriptorModel getPlugin(String pluginId, String version)
          Returns the identified plug-in or null if the plug-in does not exist.
 PluginDescriptorModel[] getPlugins()
          Returns the list of plug-ins managed by this registry.
 PluginDescriptorModel[] getPlugins(String pluginId)
          Returns all versions of the identified plug-in descriptor known to this plug-in registry.
 boolean isReadOnly()
          Returns whether or not this model object is read-only.
 boolean isResolved()
          Returns whether or not this model object has been resolved.
 void markReadOnly()
          Sets this model object and all of its descendents to be read-only.
 void markResolved()
          Sets this model object to be resolved.
 void removeFragment(String id, String version)
          Removes the fragment with id and version if it exists in this registry.
 void removeFragments(String id)
          Removes all versions of the identified plug-in fragment from this registry.
 void removePlugin(String pluginId, String version)
          Removes the plug-in with id and version if it exists in this registry.
 void removePlugins(String pluginId)
          Removes all versions of the given plug-in from this registry.
 IStatus resolve(boolean trimDisabledPlugins, boolean doCrossLinking)
          Runs a resolve through the entire registry.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PluginRegistryModel

public PluginRegistryModel()
Creates a new plug-in registry model which contains no plug-ins.

Method Detail

addFragment

public void addFragment(PluginFragmentModel fragment)
Adds the specified plug-in fragment to this registry. An existing fragment with the same unique id and version is replaced by the new value.

Parameters:
fragment - the plug-in fragment to add

addPlugin

public void addPlugin(PluginDescriptorModel plugin)
Adds the specified plug-in to this registry. An existing plug-in with the same unique id and version is replaced by the new value.

Parameters:
plugin - the plug-in descriptor to add

assertIsWriteable

protected void assertIsWriteable()
Checks that this model object is writeable. A runtime exception is thrown if it is not.


getFragment

public PluginFragmentModel getFragment(String id)
Returns the plug-in fragment with the given identifier in this plug-in registry, or null if there is no such fragment. If there are multiple versions of the identified fragment, one will be non-deterministically choosen and returned.

Parameters:
id - the unique identifier of the plug-in fragment (e.g. "com.example.acme").
Returns:
the plug-in fragment, or null

getFragment

public PluginFragmentModel getFragment(String id,
                                       String version)
Returns the identified plug-in fragment or null if the fragment does not exist.

Returns:
the matching fragment in this registry

getFragments

public PluginFragmentModel[] getFragments()
Returns the list of plug-in fragments managed by this registry.

Returns:
the fragments in this registry

getFragments

public PluginFragmentModel[] getFragments(String id)
Returns all versions of the identified plug-in fragment known to this plug-in registry. Returns an empty array if there are no fragments with the specified identifier.

Parameters:
id - the unique identifier of the plug-in fragment (e.g. "org.eclipse.core.resources").
Returns:
the fragments known to this plug-in registry with the given id

getPlugin

public PluginDescriptorModel getPlugin(String pluginId)
Returns the plug-in descriptor with the given plug-in identifier in this plug-in registry, or null if there is no such plug-in. If there are multiple versions of the identified plug-in, one will be non-deterministically choosen and returned.

Parameters:
pluginId - the unique identifier of the plug-in (e.g. "com.example.acme").
Returns:
the plug-in descriptor, or null

getPlugin

public PluginDescriptorModel getPlugin(String pluginId,
                                       String version)
Returns the identified plug-in or null if the plug-in does not exist.

Returns:
the matching plug-in in this registry

getPlugins

public PluginDescriptorModel[] getPlugins()
Returns the list of plug-ins managed by this registry.

Returns:
the plug-ins in this registry

getPlugins

public PluginDescriptorModel[] getPlugins(String pluginId)
Returns all versions of the identified plug-in descriptor known to this plug-in registry. Returns an empty array if there are no plug-ins with the specified identifier.

Parameters:
pluginId - the unique identifier of the plug-in (e.g. "org.eclipse.core.resources").
Returns:
the plug-in descriptors known to this plug-in registry

isReadOnly

public boolean isReadOnly()
Returns whether or not this model object is read-only.

Returns:
true if this model object is read-only, false otherwise
See Also:
markReadOnly()

isResolved

public boolean isResolved()
Returns whether or not this model object has been resolved.

Returns:
true if this model object has been resolved, false otherwise
See Also:
resolve(boolean, boolean)

markReadOnly

public void markReadOnly()
Sets this model object and all of its descendents to be read-only. Subclasses may extend this implementation.

See Also:
isReadOnly()

markResolved

public void markResolved()
Sets this model object to be resolved.


removeFragment

public void removeFragment(String id,
                           String version)
Removes the fragment with id and version if it exists in this registry. This method has no effect if a fragment with the given id and version cannot be found.

Parameters:
id - the unique identifier of the fragment to remove
version - the version of the fragment to remove

removeFragments

public void removeFragments(String id)
Removes all versions of the identified plug-in fragment from this registry. This method has no effect if such a fragment cannot be found.

Parameters:
id - the unique identifier of the fragments to remove

removePlugin

public void removePlugin(String pluginId,
                         String version)
Removes the plug-in with id and version if it exists in this registry. This method has no effect if a plug-in with the given id and version cannot be found.

Parameters:
pluginId - the unique identifier of the plug-in to remove
version - the version of the plug-in to remove

removePlugins

public void removePlugins(String pluginId)
Removes all versions of the given plug-in from this registry. This method has no effect if such a plug-in cannot be found.

Parameters:
pluginId - the unique identifier of the plug-ins to remove

resolve

public IStatus resolve(boolean trimDisabledPlugins,
                       boolean doCrossLinking)
Runs a resolve through the entire registry. This resolve will mark any PluginDescriptorModels which do not have access to all of their prerequisites as disabled. Prerequisites which cause cyclical dependencies will be marked as disabled. If the parameter trimDisabledPlugins is set to true, all PluginDescriptorModels which are labelled as disabled will be removed from the registry. If the paramter doCrossLinking is set to true, links will be created between ExtensionPointModels and their corresponding ExtensionModels. Not that these links will include disabled plugins if trimDisabledPlugins was set to false.

Parameters:
trimDisabledPlugins - if true, remove all disabled plugins from the registry (recommended value = true)
doCrossLinking - if true, link all ExtensionModels in the registry to their corresponding ExtensionPointModel (recommended value = true).

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.