|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The extension registry holds the master list of all discovered namespaces, extension points and extensions.
The extension registry can be queried, by name, for extension points and extensions.
The various objects that describe the contents of the extension registry
(IExtensionPoint
, IExtension
, and IConfigurationElement
)
are intended for relatively short-term use. Clients that deal with these objects
must be aware that they may become invalid if the declaring plug-in is updated
or uninstalled. If this happens, all methods on these object except
isValid()
will throw InvalidRegistryObjectException
.
Code in a plug-in that has declared that it is not dynamic aware (or not declared
anything) can safely ignore this issue, since the registry would not be
modified while it is active. However, code in a plug-in that declares that it
is dynamic aware must be careful if it accesses extension registry objects,
because it's at risk if plug-in are removed. Similarly, tools that analyze
or display the extension registry are vulnerable. Client code can pre-test for
invalid objects by calling isValid()
, which never throws this exception.
However, pre-tests are usually not sufficient because of the possibility of the
extension registry object becoming invalid as a result of a concurrent activity.
At-risk clients must treat InvalidRegistryObjectException
as if it
were a checked exception. Also, such clients should probably register a listener
with the extension registry so that they receive notification of any changes to
the registry.
Extensions and extension points are declared by generic entities called namespaces. The only fact known about namespaces is that they have unique string-based identifiers. One example of a namespace is a plug-in, for which the namespace id is the plug-in id.
This interface is not intended to be implemented by clients.
Method Summary | |
---|---|
void |
addRegistryChangeListener(IRegistryChangeListener listener)
Adds the given listener for registry change events. |
void |
addRegistryChangeListener(IRegistryChangeListener listener,
String namespace)
Adds the given listener for registry change events related to extension points in the given namespace. |
IConfigurationElement[] |
getConfigurationElementsFor(String extensionPointId)
Returns all configuration elements from all extensions configured into the identified extension point. |
IConfigurationElement[] |
getConfigurationElementsFor(String namespace,
String extensionPointName)
Returns all configuration elements from all extensions configured into the identified extension point. |
IConfigurationElement[] |
getConfigurationElementsFor(String namespace,
String extensionPointName,
String extensionId)
Returns all configuration elements from the identified extension. |
IExtension |
getExtension(String extensionId)
Returns the specified extension in this extension registry, or null if there is no such extension. |
IExtension |
getExtension(String extensionPointId,
String extensionId)
Returns the specified extension in this extension registry, or null if there is no such extension.
|
IExtension |
getExtension(String namespace,
String extensionPointName,
String extensionId)
Returns the specified extension in this extension registry, or null if there is no such extension.
|
IExtensionPoint |
getExtensionPoint(String extensionPointId)
Returns the extension point with the given extension point identifier in this extension registry, or null if there is no such
extension point. |
IExtensionPoint |
getExtensionPoint(String namespace,
String extensionPointName)
Returns the extension point in this extension registry with the given namespace and extension point simple identifier, or null if there is no such extension point. |
IExtensionPoint[] |
getExtensionPoints()
Returns all extension points known to this extension registry. |
IExtensionPoint[] |
getExtensionPoints(String namespace)
Returns all extension points declared in the given namespace. |
IExtension[] |
getExtensions(String namespace)
Returns all extensions declared in the given namespace. |
String[] |
getNamespaces()
Returns all namespaces where extensions and/or extension points. |
void |
removeRegistryChangeListener(IRegistryChangeListener listener)
Removes the given registry change listener from this registry. |
Method Detail |
public void addRegistryChangeListener(IRegistryChangeListener listener, String namespace)
Once registered, a listener starts receiving notification of changes to the registry. Registry change notifications are sent asynchronously. The listener continues to receive notifications until it is removed.
listener
- the listenernamespace
- the namespace in which to listen for changesIRegistryChangeListener
,
IRegistryChangeEvent
,
removeRegistryChangeListener(IRegistryChangeListener)
public void addRegistryChangeListener(IRegistryChangeListener listener)
This method is equivalent to:
addRegistryChangeListener(listener,null);
listener
- the listenerIRegistryChangeListener
,
IRegistryChangeEvent
,
addRegistryChangeListener(IRegistryChangeListener, String)
,
removeRegistryChangeListener(IRegistryChangeListener)
public IConfigurationElement[] getConfigurationElementsFor(String extensionPointId)
extensionPointId
- the unique identifier of the extension point
(e.g. "org.eclipse.core.resources.builders"
)
public IConfigurationElement[] getConfigurationElementsFor(String namespace, String extensionPointName)
namespace
- the namespace for the extension point
(e.g. "org.eclipse.core.resources"
)extensionPointName
- the simple identifier of the
extension point (e.g. "builders"
)
public IConfigurationElement[] getConfigurationElementsFor(String namespace, String extensionPointName, String extensionId)
namespace
- the namespace for the extension point
(e.g. "org.eclipse.core.resources"
)extensionPointName
- the simple identifier of the
extension point (e.g. "builders"
)extensionId
- the unique identifier of the extension
(e.g. "com.example.acme.coolbuilder
)
public IExtension getExtension(String extensionId)
null
if there is no such extension.
extensionId
- the unique identifier of the extension
(e.g. "com.example.acme.coolbuilder"
)
null
public IExtension getExtension(String extensionPointId, String extensionId)
null
if there is no such extension.
The first parameter identifies the extension point, and the second
parameter identifies an extension plugged in to that extension point.
extensionPointId
- the unique identifier of the extension point
(e.g. "org.eclipse.core.resources.builders"
)extensionId
- the unique identifier of the extension
(e.g. "com.example.acme.coolbuilder"
)
null
public IExtension getExtension(String namespace, String extensionPointName, String extensionId)
null
if there is no such extension.
The first two parameters identify the extension point, and the third
parameter identifies an extension plugged in to that extension point.
namespace
- the namespace for the extension point
(e.g. "org.eclipse.core.resources"
)extensionPointName
- the simple identifier of the
extension point (e.g. "builders"
)extensionId
- the unique identifier of the extension
(e.g. "com.example.acme.coolbuilder"
)
null
public IExtensionPoint getExtensionPoint(String extensionPointId)
null
if there is no such
extension point.
extensionPointId
- the unique identifier of the extension point
(e.g., "org.eclipse.core.resources.builders"
)
null
public IExtensionPoint getExtensionPoint(String namespace, String extensionPointName)
null
if there is no such extension point.
namespace
- the namespace for the given extension point
(e.g. "org.eclipse.core.resources"
)extensionPointName
- the simple identifier of the
extension point (e.g. " builders"
)
null
public IExtensionPoint[] getExtensionPoints()
public IExtensionPoint[] getExtensionPoints(String namespace)
namespace
- the namespace for the extension points
(e.g. "org.eclipse.core.resources"
)
public IExtension[] getExtensions(String namespace)
namespace
- the namespace for the extensions
(e.g. "org.eclipse.core.resources"
)
public String[] getNamespaces()
public void removeRegistryChangeListener(IRegistryChangeListener listener)
listener
- the listenerIRegistryChangeListener
,
addRegistryChangeListener(IRegistryChangeListener)
,
addRegistryChangeListener(IRegistryChangeListener, String)
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.