{
      int count = 0;
      for (EObject parent = eObject.eContainer(); parent != null; parent = parent.eContainer())
      {
        if (++count > 100000)
        {
          return getRootContainer(parent);
        }
        result = parent;
        if (parent == eObject)
        {
          throw new IllegalStateException("There is a cycle in the containment hierarchy of " + eObject);
        }
      }
    }