Adapters

org.eclipse.core.runtime.adapters

3.0

The adapters extension point allows plug-ins to declaratively register adapter factories. This information is used to by the runtime XML expression language to determine existence of adapters without causing plug-ins to be loaded. Registration of adapter factories via extension point eliminates the need to manually register adapter factories when a plug-in starts up.

<!ELEMENT extension (factory+)>

<!ATTLIST extension

point CDATA #REQUIRED

id    CDATA #IMPLIED

name  CDATA #IMPLIED>


<!ELEMENT factory (adapter+)>

<!ATTLIST factory

adaptableType CDATA #REQUIRED

class         CDATA #REQUIRED>


<!ELEMENT adapter EMPTY>

<!ATTLIST adapter

type CDATA #REQUIRED>


Following is an example of an adapter declaration. This example declares that this plug-in will provide an adapter factory that will adapt objects of type IFile to objects of type MyFile.

      

<extension point=

"org.eclipse.core.runtime.adapters"

>

<factory class=

"com.xyz.MyFileAdapterFactory"

adaptableType=

"org.eclipse.core.resources.IFile"

>

<adapter type=

"com.xyz.MyFile"

/>

</factory>

</extension>

Adapter factories registered using this extension point can be queried using the method IAdapterManager.hasAdapter, or retrieved using one of the getAdapter methods on IAdapterFactory. An adapter factory registered with this extension point does not need to be registered at runtime using IAdapterFactory.registerAdapters.

Several plug-ins in the platform provide adapters for a number of different IAdaptable objects.