public class SaveIndicatorUtil
extends java.lang.Object
resource
s or entire model
s.Modifier and Type | Method and Description |
---|---|
static java.util.Collection<org.eclipse.emf.ecore.resource.Resource> |
getDirtyResources(org.eclipse.emf.edit.domain.EditingDomain editingDomain)
Returns all
resource s in specified editing domain which are currently
dirty. |
static IModelSaveIndicator |
getModelSaveIndicator(IModelDescriptor modelDescriptor)
Returns an
IModelSaveIndicator for the provided model . |
static IResourceSaveIndicator |
getResourceSaveIndicator(org.eclipse.emf.edit.domain.EditingDomain editingDomain)
Returns an
IResourceSaveIndicator for the provided editing domain . |
static boolean |
isDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
org.eclipse.emf.ecore.resource.Resource resource)
Determines if the specified
resource in given editing domain is dirty. |
static boolean |
isDirty(IModelDescriptor modelDescriptor)
Determines if the given
model is dirty. |
static boolean |
isSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
org.eclipse.emf.common.util.URI uri)
Test if the
resource behind given URI in specified editing domain
has just been saved. |
static void |
setDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
org.eclipse.emf.ecore.resource.Resource resource)
Makes the specified
resource in given editing domain dirty. |
static void |
setSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources)
Clears dirty state of given collection of
resource s in specified editing
domain and remembers them as having just been saved. |
static void |
setSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
org.eclipse.emf.ecore.resource.Resource resource)
Clears dirty state of given
resource in specified editing domain and
remembers it as having just been saved. |
static void |
setSaved(IModelDescriptor modelDescriptor)
Clears dirty state of given
model and remembers it as having just been saved. |
static void |
unsetDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain,
org.eclipse.emf.ecore.resource.Resource resource)
Makes the specified
resource in given editing domain un-dirty. |
public static IResourceSaveIndicator getResourceSaveIndicator(org.eclipse.emf.edit.domain.EditingDomain editingDomain)
IResourceSaveIndicator
for the provided editing domain
.editingDomain
- The editing domain
for which the IResourceSaveIndicator
is to be
returned.IResourceSaveIndicator
for the given editing domain
, or
null
if no such is available.public static IModelSaveIndicator getModelSaveIndicator(IModelDescriptor modelDescriptor)
IModelSaveIndicator
for the provided model
.modelDescriptor
- The model
for which the IModelSaveIndicator
is to be returned.IModelSaveIndicator
for the given model
, or null
if no
such is available.public static boolean isDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain, org.eclipse.emf.ecore.resource.Resource resource)
resource
in given editing domain
is dirty. A
resource
is considered dirty if its content has been modified but not been saved yet.editingDomain
- The editing domain
the resource
in question is in.resource
- The resource
to be investigated.true
if specified resource
is present in given editing
domain
and is dirty, or false
otherwise.setDirty(EditingDomain, Resource)
,
getDirtyResources(EditingDomain)
,
setSaved(EditingDomain, Resource)
public static boolean isDirty(IModelDescriptor modelDescriptor)
model
is dirty. A model
is considered
dirty if it has resource
s whose content has been modified but not been saved yet.modelDescriptor
- The model
to be investigated.true
if specified model
has dirty resource
s, or
false
otherwise.setSaved(IModelDescriptor)
public static void setDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain, org.eclipse.emf.ecore.resource.Resource resource)
resource
in given editing domain
dirty.editingDomain
- The editing domain
the resource
in question is in.resource
- The resource
to be handled.isDirty(EditingDomain, Resource)
,
unsetDirty(EditingDomain, Resource)
,
getDirtyResources(EditingDomain)
public static void unsetDirty(org.eclipse.emf.edit.domain.EditingDomain editingDomain, org.eclipse.emf.ecore.resource.Resource resource)
resource
in given editing domain
un-dirty.editingDomain
- The editing domain
the resource
in question is in.resource
- The resource
to be handled.isDirty(EditingDomain, Resource)
,
setDirty(EditingDomain, Resource)
,
getDirtyResources(EditingDomain)
public static java.util.Collection<org.eclipse.emf.ecore.resource.Resource> getDirtyResources(org.eclipse.emf.edit.domain.EditingDomain editingDomain)
resource
s in specified editing domain
which are currently
dirty.editingDomain
- The editing domain
the potentially resource
s are in.resource
s which are present in given editing
domain
and are currently dirty, or and empty collection if no dirty resources exist in given
editing domain
.isDirty(IModelDescriptor)
,
setDirty(EditingDomain, Resource)
,
setSaved(EditingDomain, Collection)
public static boolean isSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain, org.eclipse.emf.common.util.URI uri)
resource
behind given URI
in specified editing domain
has just been saved. This method typically needs to be called when an resource change
event
indicates that the content of the file
behind given URI
has changed. Based on the
returned result the caller can determine if a resource change event
is just a
consequence of a preceding save operation or if the file
's content has been changed otherwise
(e.g., via a text editor or some other tool affecting the resource
in its serialized form).editingDomain
- The editing domain
the resource
behind given URI
is in.uri
- The URI
of the resource
to be investigated.true
if given resource
is present in given editing
domain
and has just been saved, or false
otherwise.setSaved(EditingDomain, Resource)
,
setSaved(EditingDomain, Collection)
public static void setSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain, org.eclipse.emf.ecore.resource.Resource resource)
resource
in specified editing domain
and
remembers it as having just been saved. This method needs to be called by all clients which perform a save
operation of some resource
right after the save operation has been completed. It enables clients
to determine if subsequently raised resource change event
s are just a consequence of
the preceding save operation or if the underlying file
's content has been changed otherwise (e.g.,
via a text editor or some other tool affecting the resource
in its serialized form).editingDomain
- The editing domain
the resource
in question is in.resource
- The resource
to be handled.isDirty(EditingDomain, Resource)
,
isSaved(EditingDomain, URI)
,
setSaved(EditingDomain, Collection)
public static void setSaved(org.eclipse.emf.edit.domain.EditingDomain editingDomain, java.util.Collection<org.eclipse.emf.ecore.resource.Resource> resources)
resource
s in specified editing
domain
and remembers them as having just been saved. This method needs to be called by all clients which perform
a save operation of some collection of resource
s right after the save operation has been
completed. Clients can then call isSaved(EditingDomain, URI)
to determine if subsequently raised
resource change event
s are just a consequence of the preceding save operation or if
the underlying file
s' content has been changed otherwise (e.g., via a text editor or some other
tool affecting the resource
in its serialized form).editingDomain
- The editing domain
the resource
s in question are in.resource
- The collection of resource
s to be handled.isDirty(EditingDomain, Resource)
,
isSaved(EditingDomain, URI)
,
setSaved(EditingDomain, Resource)
public static void setSaved(IModelDescriptor modelDescriptor)
model
and remembers it as having just been saved. This
method needs to be called by all clients which perform a save operation of some model
right after the save operation has been completed. Clients can then call isSaved(EditingDomain, URI)
to
determine if subsequently raised resource change event
s are just a consequence of
the preceding save operation or if the underlying file
s' content has been changed otherwise (e.g.,
via a text editor or some other tool affecting the resource
in its serialized form).modelDescriptor
- The model
to be handled.isDirty(IModelDescriptor)