Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.ui.internal
Class ObjectContributorManager  view ObjectContributorManager download ObjectContributorManager.java

java.lang.Object
  extended byorg.eclipse.ui.internal.ObjectContributorManager
Direct Known Subclasses:
ObjectActionContributorManager

public abstract class ObjectContributorManager
extends java.lang.Object

This class is a default implementation of IObjectContributorManager. It provides fast merging of contributions with the following semantics:


Field Summary
protected  java.util.Map adapterLookup
          Cache of resource adapter class contributor search paths; null if none.
protected  java.util.Map contributors
          Table of contributors.
private static java.util.List EMPTY_LIST
           
protected  java.util.Map objectLookup
          Cache of object class contributor search paths; null if none.
 
Constructor Summary
ObjectContributorManager()
          Constructs a new contributor manager.
 
Method Summary
protected  java.util.List addContributorsFor(java.lang.Class objectClass)
          Return the list of contributors for the supplied class.
private  void addContributorsFor(java.util.List types, java.util.List result)
          Adds contributors for the given types to the result list.
private  void cacheAdapterLookup(java.lang.Class adapterClass, java.util.List results)
          Cache the resource adapter class contributor search path.
private  void cacheObjectLookup(java.lang.Class objectClass, java.util.List results)
          Cache the object class contributor search path.
protected  java.util.List computeClassOrder(java.lang.Class extensibleClass)
          Returns the class search order starting with extensibleClass.
protected  java.util.List computeInterfaceOrder(java.util.List classList)
          Returns the interface search order for the class hierarchy described by classList.
 void flushLookup()
          Flushes the cache of contributor search paths.
protected  java.lang.Object getAdaptedResource(java.lang.Object object)
          Get the adapted resource for the supplied object.
 java.util.Collection getContributors()
          Get the contributions registered to this manager.
protected  java.util.List getContributors(java.lang.Class objectClass)
          Returns all the contributors registered against the given object class.
protected  java.util.List getContributors(java.lang.Class objectClass, java.lang.Class resourceClass)
          Returns all the contributors registered against the given object class and the resource class that it has an Adaptable for.
protected  java.util.List getContributors(java.lang.Object object)
          Get the contributors for object including those it adapts to.
 boolean hasContributorsFor(java.lang.Object object)
          Returns true if contributors exist in the manager for this object.
private  void internalComputeInterfaceOrder(java.lang.Class[] interfaces, java.util.List result, java.util.Map seen)
          Add interface Class objects to the result list based on the class hierarchy.
 boolean isApplicableTo(org.eclipse.jface.viewers.IStructuredSelection selection, IObjectContributor contributor)
           
 boolean isApplicableTo(java.util.List list, IObjectContributor contributor)
           
 void registerContributor(IObjectContributor contributor, java.lang.String targetType)
           
 void unregisterAllContributors()
           
 void unregisterContributor(IObjectContributor contributor, java.lang.String targetType)
           
 void unregisterContributors(java.lang.String targetType)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

EMPTY_LIST

private static final java.util.List EMPTY_LIST

contributors

protected java.util.Map contributors
Table of contributors.


objectLookup

protected java.util.Map objectLookup
Cache of object class contributor search paths; null if none.


adapterLookup

protected java.util.Map adapterLookup
Cache of resource adapter class contributor search paths; null if none.

Constructor Detail

ObjectContributorManager

public ObjectContributorManager()
Constructs a new contributor manager.

Method Detail

addContributorsFor

private void addContributorsFor(java.util.List types,
                                java.util.List result)
Adds contributors for the given types to the result list.


computeClassOrder

protected final java.util.List computeClassOrder(java.lang.Class extensibleClass)
Returns the class search order starting with extensibleClass. The search order is defined in this class' comment.


computeInterfaceOrder

protected final java.util.List computeInterfaceOrder(java.util.List classList)
Returns the interface search order for the class hierarchy described by classList. 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.


cacheAdapterLookup

private void cacheAdapterLookup(java.lang.Class adapterClass,
                                java.util.List results)
Cache the resource adapter class contributor search path.


cacheObjectLookup

private void cacheObjectLookup(java.lang.Class objectClass,
                               java.util.List results)
Cache the object class contributor search path.


getContributors

public java.util.Collection getContributors()
Get the contributions registered to this manager.

Since:
3.0

getContributors

protected java.util.List getContributors(java.lang.Class objectClass)
Returns all the contributors registered against the given object class.


addContributorsFor

protected java.util.List addContributorsFor(java.lang.Class objectClass)
Return the list of contributors for the supplied class.


getContributors

protected java.util.List getContributors(java.lang.Object object)
Get the contributors for object including those it adapts to.


hasContributorsFor

public boolean hasContributorsFor(java.lang.Object object)
Returns true if contributors exist in the manager for this object.


internalComputeInterfaceOrder

private void internalComputeInterfaceOrder(java.lang.Class[] interfaces,
                                           java.util.List result,
                                           java.util.Map seen)
Add interface Class objects to the result list based on the class hierarchy. Interfaces will be searched based on their position in the result list.


isApplicableTo

public boolean isApplicableTo(org.eclipse.jface.viewers.IStructuredSelection selection,
                              IObjectContributor contributor)

isApplicableTo

public boolean isApplicableTo(java.util.List list,
                              IObjectContributor contributor)

registerContributor

public void registerContributor(IObjectContributor contributor,
                                java.lang.String targetType)

unregisterAllContributors

public void unregisterAllContributors()

unregisterContributor

public void unregisterContributor(IObjectContributor contributor,
                                  java.lang.String targetType)

unregisterContributors

public void unregisterContributors(java.lang.String targetType)

getContributors

protected java.util.List getContributors(java.lang.Class objectClass,
                                         java.lang.Class resourceClass)
Returns all the contributors registered against the given object class and the resource class that it has an Adaptable for.


getAdaptedResource

protected java.lang.Object getAdaptedResource(java.lang.Object object)
Get the adapted resource for the supplied object. If the object is an instance of IResource or is not an instance of IAdaptable return null. Otherwise see if it adapts to IResource via IContributorResourceAdapter.