private void removeDirtyResource(Resource resource) {
    IDirtyResource dirtyResource = uri2dirtyResource.get(resource.getURI());
    dirtyStateManager.discardDirtyState(dirtyResource);
    uri2dirtyResource.remove(resource.getURI());
    // TODO: remove adapter EcoreUtil.getExistingAdapter(resource, DirtyResourceUpdater.class) ==
    // null

  }
 private void createDirtyResource(Resource resource) {
   IResourceServiceProvider resourceServiceProvider =
       IResourceServiceProvider.Registry.INSTANCE.getResourceServiceProvider(resource.getURI());
   if (resourceServiceProvider == null) {
     return;
   }
   final DirtyResourceAdapter dirtyResource =
       new DirtyResourceAdapter(resource, resourceServiceProvider);
   dirtyStateManager.manageDirtyState(dirtyResource);
   uri2dirtyResource.put(resource.getURI(), dirtyResource);
   if (EcoreUtil.getExistingAdapter(resource, DirtyResourceUpdater.class) == null)
     resource.eAdapters().add(new DirtyResourceUpdater(dirtyResource));
 }