Class ObjectContributorManager

java.lang.Object
org.eclipse.ui.internal.ObjectContributorManager
All Implemented Interfaces:
IExtensionChangeHandler
Direct Known Subclasses:
ObjectActionContributorManager

public abstract class ObjectContributorManager extends Object implements IExtensionChangeHandler
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 Details Link icon

    • contributors Link icon

      protected Map contributors
      Table of contributors.
    • objectLookup Link icon

      protected Map objectLookup
      Cache of object class contributor search paths; null if none.
    • resourceAdapterLookup Link icon

      protected Map resourceAdapterLookup
      Cache of resource adapter class contributor search paths; null if none.
    • adaptableLookup Link icon

      protected Map adaptableLookup
      Cache of adaptable class contributor search paths; null if none.
    • contributorRecordSet Link icon

      protected Set contributorRecordSet
  • Constructor Details Link icon

    • ObjectContributorManager Link icon

      public ObjectContributorManager()
      Constructs a new contributor manager.
  • Method Details Link icon

    • getExtensionPointFilter Link icon

      protected String 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 Link icon

      protected final List computeClassOrder(Class extensibleClass)
      Returns the class search order starting with extensibleClass. The search order is defined in this class' comment.
    • computeInterfaceOrder Link icon

      protected final List computeInterfaceOrder(List classList)
      Returns the interface search order for the class hierarchy described by classList. The search order is defined in this class' comment.
    • flushLookup Link icon

      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 Link icon

      public Collection getContributors()
      Get the contributions registered to this manager.
      Returns:
      an unmodifiable Collection containing all registered contributions. The objects in this Collection will be Lists containing the actual contributions.
      Since:
      3.0
    • addContributorsFor Link icon

      protected List addContributorsFor(Class objectClass)
      Return the list of contributors for the supplied class.
    • hasContributorsFor Link icon

      public boolean hasContributorsFor(Object object)
      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 Link icon

      public boolean isApplicableTo(IStructuredSelection selection, IObjectContributor contributor)
      Return whether the given contributor is applicable to all elements in the selection.
      Parameters:
      selection - the selection
      contributor - the contributor
      Returns:
      whether it is applicable
    • isApplicableTo Link icon

      public boolean isApplicableTo(List list, IObjectContributor contributor)
      Return whether the given contributor is applicable to all elements in the list.
      Parameters:
      list - the selection
      contributor - the contributor
      Returns:
      whether it is applicable
    • registerContributor Link icon

      public void registerContributor(IObjectContributor contributor, String targetType)
      Register a contributor.
      Parameters:
      contributor - the contributor
      targetType - the target type
    • unregisterAllContributors Link icon

      public void unregisterAllContributors()
      Unregister all contributors.
    • unregisterContributor Link icon

      public void unregisterContributor(IObjectContributor contributor, String targetType)
      Unregister a contributor from the target type.
      Parameters:
      contributor - the contributor
      targetType - the target type
    • unregisterContributors Link icon

      public void unregisterContributors(String targetType)
      Unregister all contributors for the target type.
      Parameters:
      targetType - the target type
    • getContributors Link icon

      protected List getContributors(Object object)
    • getObjectContributors Link icon

      protected List getObjectContributors(Class objectClass)
      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 Link icon

      protected List getResourceContributors(Class resourceClass)
      Returns the contributions for the given IResourceclass. 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 Link icon

      protected List getAdaptableContributors(String adapterType)
      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 Link icon

      protected void removeCommonAdapters(List adapters, List results)
      Prunes from the list of adapters type names that are in the class search order of every class in results.
      Since:
      3.1
    • computeCombinedOrder Link icon

      protected List computeCombinedOrder(Class inputClass)
      Returns the class search order starting with extensibleClass. The search order is defined in this class' comment.
    • removeExtension Link icon

      public void removeExtension(IExtension source, Object[] objects)
      Description copied from interface: IExtensionChangeHandler
      This method is called after the removal of an extension.
      Specified by:
      removeExtension in interface IExtensionChangeHandler
      Parameters:
      source - the extension being removed
      objects - the objects that were associated with the removed extension
    • dispose Link icon

      public void dispose()
      Remove listeners and dispose of this manager.
      Since:
      3.1
    • getContributors Link icon

      protected List getContributors(List elements)
      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)