code: public void clearResourceSet(final ResourceSet resourceSet) {
      final boolean wasDeliver = resourceSet.eDeliver();
      try {
        resourceSet.eSetDeliver(false);
        resourceSet.getResources().clear();
      } finally {
        resourceSet.eSetDeliver(wasDeliver);
      }
    }
docs: Clears the content of the resource set without sending notifications.
  This avoids unnecessary, explicit unloads.