## org.eclipse.emf.compare.util
Class AdapterUtils

    java.lang.Object
      org.eclipse.emf.compare.util.AdapterUtils

    public final class AdapterUtils

extends java.lang.Object

Useful methods for EMF adapter factories handling.

Method Summary

`static

`<T> T`

`

`adapt(org.eclipse.emf.ecore.EObject eObj, java.lang.Class<? extends T> type)`
This will try and return an adapter of the given type associated to the given EObject.

`static org.eclipse.emf.common.notify.AdapterFactory` `getAdapterFactory()` Returns a factory built with all the `AdapterFactory` instances available in the global registry.
`static java.lang.Object` `getItemProviderImage(org.eclipse.emf.ecore.EObject eObj)` This will try and get the IItemLabelProvider associated to the given EObject if its ItemProviderFactory is registered, then return the image it provides.
`static java.lang.String` `getItemProviderText(org.eclipse.emf.ecore.EObject eObj)` This will try and get the IItemLabelProvider associated to the given EObject if its ItemProviderFactory is registered, then return the text it provides.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Method Detail

### adapt

    public static <T> T adapt(org.eclipse.emf.ecore.EObject eObj,
                              java.lang.Class<? extends T> type)

  This will try and return an adapter of the given type associated to the given EObject.

  Type Parameters:
    `T` - Type of the adapter to return.
  Parameters:
    `eObj` - The EObject we seek an adapter for.
    `type` - The sought adapter's type.
  Returns:
    An associated adapter.
  Since:
    0.8
  See Also:
    `AdapterFactory.adapt(Object, Object)`

### getAdapterFactory

    public static org.eclipse.emf.common.notify.AdapterFactory getAdapterFactory()

  Returns a factory built with all the `AdapterFactory` instances available in the global registry.

  Returns:
    A factory built with all the `AdapterFactory` instances available in the global registry.

### getItemProviderImage

    public static java.lang.Object getItemProviderImage(org.eclipse.emf.ecore.EObject eObj)

  This will try and get the IItemLabelProvider associated to the given EObject if its ItemProviderFactory is registered, then return the image it provides.

  Parameters:
    `eObj` - EObject we need an image for.
  Returns:
    The Image provided by the IItemLabelProvider associated with `eObj`, `null` if it cannot be found.
  Since:
    0.8
  See Also:
    `IItemLabelProvider.getImage(Object)`

### getItemProviderText

    public static java.lang.String getItemProviderText(org.eclipse.emf.ecore.EObject eObj)

  This will try and get the IItemLabelProvider associated to the given EObject if its ItemProviderFactory is registered, then return the text it provides.

  Parameters:
    `eObj` - EObject we need the text of.
  Returns:
    The text provided by the IItemLabelProvider associated with `eObj`, `null` if it cannot be found.
  Since:
    0.8
  See Also:
    `IItemLabelProvider.getText(Object)`

Copyright 2006 IBM Corporation and others. All Rights Reserved.