/**
   * Returns the adapter of the specified type.
   *
   * @param anObject
   * @param adapters list of adapters to search.
   * @param type the type of adapter.
   * @return an adapter from the list or null.
   */
  public static Adapter getAdapter(EObject anObject, List adapters, Object type) {

    Object[] adaptArray = ((EAdapterList) adapters).data();
    if (adaptArray == null) return null;
    for (int i = 0; i < adaptArray.length; i++) {
      Adapter adapter = (Adapter) adaptArray[i];
      if (adapter != null && adapter.isAdapterForType(type)) {
        return adapter;
      }
    }
    return null;
  }