public abstract class AbstractSharedObjectContainerAdapterFactory extends AbstractContainerAdapterFactory
IAdapterFactory
interface. It checks that the first parameter of the
AbstractContainerAdapterFactory.getAdapter(Object, Class)
method (adaptableObject) is an instance of
ISharedObjectContainer
. If it is, then the method
getSharedObjectAdapter(ISharedObjectContainer, Class)
is called with
the ISharedObjectContainer and Class passed in as arguments.Modifier and Type | Field and Description |
---|---|
protected static int |
ADD_ADAPTER_ERROR_CODE |
protected static java.lang.String |
ADD_ADAPTER_ERROR_MESSAGE |
Constructor and Description |
---|
AbstractSharedObjectContainerAdapterFactory() |
Modifier and Type | Method and Description |
---|---|
protected abstract ISharedObject |
createAdapter(ISharedObjectContainer container,
java.lang.Class adapterType,
ID adapterID)
Create an adapter instance that implements
ISharedObject and
adapterType. |
protected ID |
createAdapterID(ISharedObjectContainer container,
java.lang.Class adapterType)
Get the adapterID for the given adapterType
|
protected java.util.Map |
createAdapterProperties(ISharedObjectContainer container,
java.lang.Class adapterType,
ID sharedObjectID,
ISharedObject sharedObjectAdapter)
Get properties to associate with new shared object adapter creation
|
abstract java.lang.Class[] |
getAdapterList() |
protected java.lang.Object |
getContainerAdapter(IContainer container,
java.lang.Class adapterType)
Method called by implementation of
AbstractContainerAdapterFactory.getAdapter(Object, Class) if the
adaptableObject is an instance of IContainer . |
protected ISharedObject |
getSharedObjectAdapter(ISharedObjectContainer container,
java.lang.Class adapterType)
Get the
ISharedObject adapter for given
ISharedObjectContainer . |
getAdapter
protected static final int ADD_ADAPTER_ERROR_CODE
protected static final java.lang.String ADD_ADAPTER_ERROR_MESSAGE
public AbstractSharedObjectContainerAdapterFactory()
protected java.lang.Object getContainerAdapter(IContainer container, java.lang.Class adapterType)
AbstractContainerAdapterFactory
AbstractContainerAdapterFactory.getAdapter(Object, Class)
if the
adaptableObject is an instance of IContainer
. Subclasses should implement to
return the proper container adapter object based upon the given adapterType.getContainerAdapter
in class AbstractContainerAdapterFactory
container
- the IContainer adaptable object provided to the adapter. Will not be null
.adapterType
- the type (interface) of the adapter on the given container. Will not be null
null
.protected ISharedObject getSharedObjectAdapter(ISharedObjectContainer container, java.lang.Class adapterType)
ISharedObject
adapter for given
ISharedObjectContainer
. The resulting ISharedObject
must
also implement the adapterType interface. Once called, this
method will call the following methods in order:
createAdapterID(ISharedObjectContainer, Class)
createAdapter(ISharedObjectContainer, Class, ID)
createAdapterProperties(ISharedObjectContainer, Class, ID, ISharedObject)
container
- the ISharedObjectContainer
that will hold the new
ISharedObject
adapteradapterType
- the type that the ISharedObject
must also implement to
be an adapterprotected java.util.Map createAdapterProperties(ISharedObjectContainer container, java.lang.Class adapterType, ID sharedObjectID, ISharedObject sharedObjectAdapter)
container
- the container that will contain the new adapter shared objectadapterType
- the adapterType for the new shared objectsharedObjectID
- the ID for the new shared object adaptersharedObjectAdapter
- the new shared object adapterprotected ID createAdapterID(ISharedObjectContainer container, java.lang.Class adapterType)
container
- the container the adapter will be added toadapterType
- the type of the adaptergetSharedObjectAdapter(ISharedObjectContainer, Class)
will also return nullprotected abstract ISharedObject createAdapter(ISharedObjectContainer container, java.lang.Class adapterType, ID adapterID)
ISharedObject
and
adapterType. The resulting instance must implement both
ISharedObject
and adapterTypecontainer
- the container that will contain the new adapter instanceadapterType
- the adapter type. The returned value must implement this
interfaceadapterID
- the ID to use for the new adaptergetSharedObjectAdapter(ISharedObjectContainer, Class)
will also return nullpublic abstract java.lang.Class[] getAdapterList()
getAdapterList
in interface org.eclipse.core.runtime.IAdapterFactory
getAdapterList
in class AbstractContainerAdapterFactory