Class ExtensionTracker
java.lang.Object
org.eclipse.core.runtime.dynamichelpers.ExtensionTracker
- All Implemented Interfaces:
EventListener
,IExtensionTracker
,IRegistryChangeListener
Implementation of the IExtensionTracker.
This class can be used without OSGi running.
- Since:
- 3.1
- See Also:
-
Field Summary
Fields inherited from interface org.eclipse.core.runtime.dynamichelpers.IExtensionTracker
REF_SOFT, REF_STRONG, REF_WEAK
-
Constructor Summary
ConstructorsConstructorDescriptionConstruct a new instance of the extension tracker.ExtensionTracker
(IExtensionRegistry theRegistry) Construct a new instance of the extension tracker using the given registry containing tracked extensions and extension points. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
applyAdd
(IExtensionChangeHandler handler, IExtension extension) protected void
applyRemove
(IExtensionChangeHandler handler, IExtension removedExtension, Object[] removedObjects) void
close()
Close the tracker.static IFilter
Return an instance of filter matching all changes for the given extension point.static IFilter
Return an instance of filter matching all changes for the given extension points.static IFilter
Return an instance of filter matching all changes from a given plugin.Object[]
getObjects
(IExtension element) Return all the objects that have been associated with the given extension.void
registerHandler
(IExtensionChangeHandler handler, IFilter filter) Register an extension change handler with this tracker using the given filter.void
registerObject
(IExtension element, Object object, int referenceType) Create an association between the given extension and the given object.void
Implementation of IRegistryChangeListener interface.void
unregisterHandler
(IExtensionChangeHandler handler) Unregister the given extension change handler previously registered with this tracker.Object[]
unregisterObject
(IExtension extension) Remove all the objects associated with the given extension.void
unregisterObject
(IExtension extension, Object object) Remove an association between the given extension and the given object.
-
Constructor Details
-
ExtensionTracker
public ExtensionTracker()Construct a new instance of the extension tracker. -
ExtensionTracker
Construct a new instance of the extension tracker using the given registry containing tracked extensions and extension points.- Parameters:
theRegistry
- the extension registry to track- Since:
- org.eclipse.equinox.registry 3.2
-
-
Method Details
-
registerHandler
Description copied from interface:IExtensionTracker
Register an extension change handler with this tracker using the given filter.- Specified by:
registerHandler
in interfaceIExtensionTracker
- Parameters:
handler
- the handler to be registeredfilter
- the filter to use to choose interesting changes
-
unregisterHandler
Description copied from interface:IExtensionTracker
Unregister the given extension change handler previously registered with this tracker.- Specified by:
unregisterHandler
in interfaceIExtensionTracker
- Parameters:
handler
- the handler to be unregistered
-
registerObject
Description copied from interface:IExtensionTracker
Create an association between the given extension and the given object. The referenceType indicates how strongly the object is being kept in memory. There is 3 possible values:IExtensionTracker.REF_STRONG
,IExtensionTracker.REF_SOFT
,IExtensionTracker.REF_WEAK
.- Specified by:
registerObject
in interfaceIExtensionTracker
- Parameters:
element
- the extensionobject
- the object to associate with the extensionreferenceType
- one of REF_STRONG, REF_SOFT, REF_WEAK- See Also:
-
registryChanged
Implementation of IRegistryChangeListener interface.This method must not be called by clients.
- Specified by:
registryChanged
in interfaceIRegistryChangeListener
- Parameters:
event
- the registry change event- See Also:
-
applyAdd
-
applyRemove
protected void applyRemove(IExtensionChangeHandler handler, IExtension removedExtension, Object[] removedObjects) -
getObjects
Description copied from interface:IExtensionTracker
Return all the objects that have been associated with the given extension. All objects registered strongly will be return unless they have been unregistered. The objects registered softly or weakly may not be returned if they have been garbage collected. Return an empty array if no associations exist.- Specified by:
getObjects
in interfaceIExtensionTracker
- Parameters:
element
- the extension for which the object must be returned- Returns:
- the array of associated objects
-
close
public void close()Description copied from interface:IExtensionTracker
Close the tracker. All registered objects are freed and all handlers are being automatically removed.- Specified by:
close
in interfaceIExtensionTracker
-
unregisterObject
Description copied from interface:IExtensionTracker
Remove an association between the given extension and the given object.- Specified by:
unregisterObject
in interfaceIExtensionTracker
- Parameters:
extension
- the extension under which the object has been registeredobject
- the object to unregister
-
unregisterObject
Description copied from interface:IExtensionTracker
Remove all the objects associated with the given extension. Return the removed objects.- Specified by:
unregisterObject
in interfaceIExtensionTracker
- Parameters:
extension
- the extension for which the objects are removed- Returns:
- the objects that were associated with the extension
-
createExtensionPointFilter
Return an instance of filter matching all changes for the given extension point.- Parameters:
xpt
- the extension point- Returns:
- a filter
-
createExtensionPointFilter
Return an instance of filter matching all changes for the given extension points.- Parameters:
xpts
- the extension points used to filter- Returns:
- a filter
-
createNamespaceFilter
Return an instance of filter matching all changes from a given plugin.- Parameters:
id
- the plugin id- Returns:
- a filter
-