{
    for (InternalEObject parent = (InternalEObject)eObject; parent != null; parent = parent.eInternalContainer())
    {
      Resource resource = parent.eDirectResource();
      if (resource != null && resource.getResourceSet() == ancestorResourceSet)
      {
        return true;
      }
    }
    return false;
  }