Package org.eclipse.ui.internal
Class ObjectContributorManager
java.lang.Object
org.eclipse.ui.internal.ObjectContributorManager
- All Implemented Interfaces:
IExtensionChangeHandler
- Direct Known Subclasses:
ObjectActionContributorManager
This class is a default implementation of
IObjectContributorManager. It provides fast merging of
contributions with the following semantics:
- All of the matching contributors will be invoked per property lookup
- The search order from a class with the definition
class X extends Y implements A, B
is as follows: -
- the target's class: X
- X's superclasses in order to
Object - a depth-first traversal of the target class's interfaces in the order
returned by
getInterfaces()(in the example, A and its superinterfaces then B and its superinterfaces)
- See Also:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected MapCache of adaptable class contributor search paths;nullif none.protected Setprotected MapTable of contributors.protected MapCache of object class contributor search paths;nullif none.protected MapCache of resource adapter class contributor search paths;nullif none. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected ListaddContributorsFor(Class objectClass) Return the list of contributors for the supplied class.protected final ListcomputeClassOrder(Class extensibleClass) Returns the class search order starting withextensibleClass.protected ListcomputeCombinedOrder(Class inputClass) Returns the class search order starting withextensibleClass.protected final ListcomputeInterfaceOrder(List classList) Returns the interface search order for the class hierarchy described byclassList.voiddispose()Remove listeners and dispose of this manager.voidFlushes the cache of contributor search paths.protected ListgetAdaptableContributors(String adapterType) Returns the contributions for the given type name.Get the contributions registered to this manager.protected ListgetContributors(Object object) protected ListgetContributors(List elements) Returns the list of contributors that are interested in the given list of model elements.protected StringReturn the extension point id (local to org.eclipse.ui) that this manager is associated with.protected ListgetObjectContributors(Class objectClass) Returns the contributions for the given class.protected ListgetResourceContributors(Class resourceClass) Returns the contributions for the givenIResourceclass.booleanhasContributorsFor(Object object) Returns true if contributors exist in the manager for this object and any of it's super classes, interfaces, or adapters.booleanisApplicableTo(List list, IObjectContributor contributor) Return whether the given contributor is applicable to all elements in the list.booleanisApplicableTo(IStructuredSelection selection, IObjectContributor contributor) Return whether the given contributor is applicable to all elements in the selection.voidregisterContributor(IObjectContributor contributor, String targetType) Register a contributor.protected voidremoveCommonAdapters(List adapters, List results) Prunes from the list of adapters type names that are in the class search order of every class inresults.voidremoveExtension(IExtension source, Object[] objects) This method is called after the removal of an extension.voidUnregister all contributors.voidunregisterContributor(IObjectContributor contributor, String targetType) Unregister a contributor from the target type.voidunregisterContributors(String targetType) Unregister all contributors for the target type.Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.eclipse.core.runtime.dynamichelpers.IExtensionChangeHandler
addExtension
-
Field Details
-
contributors
Table of contributors. -
objectLookup
Cache of object class contributor search paths;nullif none. -
resourceAdapterLookup
Cache of resource adapter class contributor search paths;nullif none. -
adaptableLookup
Cache of adaptable class contributor search paths;nullif none. -
contributorRecordSet
-
-
Constructor Details
-
ObjectContributorManager
public ObjectContributorManager()Constructs a new contributor manager.
-
-
Method Details
-
getExtensionPointFilter
Return the extension point id (local to org.eclipse.ui) that this manager is associated with. Default implementation returns null, which implies no relationship with a particular extension.- Returns:
- the extension point id
- Since:
- 3.4
-
computeClassOrder
Returns the class search order starting withextensibleClass. The search order is defined in this class' comment. -
computeInterfaceOrder
Returns the interface search order for the class hierarchy described byclassList. The search order is defined in this class' comment. -
flushLookup
public void flushLookup()Flushes the cache of contributor search paths. This is generally required whenever a contributor is added or removed.It is likely easier to just toss the whole cache rather than trying to be smart and remove only those entries affected.
-
getContributors
Get the contributions registered to this manager.- Returns:
- an unmodifiable
Collectioncontaining all registered contributions. The objects in thisCollectionwill beLists containing the actual contributions. - Since:
- 3.0
-
addContributorsFor
Return the list of contributors for the supplied class. -
hasContributorsFor
Returns true if contributors exist in the manager for this object and any of it's super classes, interfaces, or adapters.- Parameters:
object- the object to test- Returns:
- whether the object has contributors
-
isApplicableTo
Return whether the given contributor is applicable to all elements in the selection.- Parameters:
selection- the selectioncontributor- the contributor- Returns:
- whether it is applicable
-
isApplicableTo
Return whether the given contributor is applicable to all elements in the list.- Parameters:
list- the selectioncontributor- the contributor- Returns:
- whether it is applicable
-
registerContributor
Register a contributor.- Parameters:
contributor- the contributortargetType- the target type
-
unregisterAllContributors
public void unregisterAllContributors()Unregister all contributors. -
unregisterContributor
Unregister a contributor from the target type.- Parameters:
contributor- the contributortargetType- the target type
-
unregisterContributors
Unregister all contributors for the target type.- Parameters:
targetType- the target type
-
getContributors
-
getObjectContributors
Returns the contributions for the given class. This considers contributors on any super classes and interfaces.- Parameters:
objectClass- the class to search for contributions.- Returns:
- the contributions for the given class. This considers contributors on any super classes and interfaces.
- Since:
- 3.1
-
getResourceContributors
Returns the contributions for the givenIResourceclass. This considers contributors on any super classes and interfaces. This will only return contributions that are adaptable.- Parameters:
resourceClass- the class to search for contributions.- Returns:
- the contributions for the given class. This considers adaptable contributors on any super classes and interfaces.
- Since:
- 3.1
-
getAdaptableContributors
Returns the contributions for the given type name.- Parameters:
adapterType- the class to search for contributions.- Returns:
- the contributions for the given class. This considers contributors to this specific type.
- Since:
- 3.1
-
removeCommonAdapters
Prunes from the list of adapters type names that are in the class search order of every class inresults.- Since:
- 3.1
-
computeCombinedOrder
Returns the class search order starting withextensibleClass. The search order is defined in this class' comment. -
removeExtension
Description copied from interface:IExtensionChangeHandlerThis method is called after the removal of an extension.- Specified by:
removeExtensionin interfaceIExtensionChangeHandler- Parameters:
source- the extension being removedobjects- the objects that were associated with the removed extension
-
dispose
public void dispose()Remove listeners and dispose of this manager.- Since:
- 3.1
-
getContributors
Returns the list of contributors that are interested in the given list of model elements.- Parameters:
elements- a list of model elements (Object)- Returns:
- the list of interested contributors (
IObjectContributor)
-