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 voidapplyAdd(IExtensionChangeHandler handler, IExtension extension) protected voidapplyRemove(IExtensionChangeHandler handler, IExtension removedExtension, Object[] removedObjects) voidclose()Close the tracker.static IFilterReturn an instance of filter matching all changes for the given extension point.static IFilterReturn an instance of filter matching all changes for the given extension points.static IFilterReturn 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.voidregisterHandler(IExtensionChangeHandler handler, IFilter filter) Register an extension change handler with this tracker using the given filter.voidregisterObject(IExtension element, Object object, int referenceType) Create an association between the given extension and the given object.voidImplementation of IRegistryChangeListener interface.voidunregisterHandler(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.voidunregisterObject(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:IExtensionTrackerRegister an extension change handler with this tracker using the given filter.- Specified by:
registerHandlerin interfaceIExtensionTracker- Parameters:
handler- the handler to be registeredfilter- the filter to use to choose interesting changes
-
unregisterHandler
Description copied from interface:IExtensionTrackerUnregister the given extension change handler previously registered with this tracker.- Specified by:
unregisterHandlerin interfaceIExtensionTracker- Parameters:
handler- the handler to be unregistered
-
registerObject
Description copied from interface:IExtensionTrackerCreate 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:
registerObjectin 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:
registryChangedin 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:IExtensionTrackerReturn 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:
getObjectsin 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:IExtensionTrackerClose the tracker. All registered objects are freed and all handlers are being automatically removed.- Specified by:
closein interfaceIExtensionTracker
-
unregisterObject
Description copied from interface:IExtensionTrackerRemove an association between the given extension and the given object.- Specified by:
unregisterObjectin interfaceIExtensionTracker- Parameters:
extension- the extension under which the object has been registeredobject- the object to unregister
-
unregisterObject
Description copied from interface:IExtensionTrackerRemove all the objects associated with the given extension. Return the removed objects.- Specified by:
unregisterObjectin 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
-