public class DefaultPersistencyBehavior
extends java.lang.Object
DiagramBehavior behavior extension
that controls the persistence behavior of the Graphiti diagram Editor.
Clients may subclass to change the behavior; use
DiagramBehavior.createPersistencyBehavior() to return the instance
that shall be used.DiagramBehavior.| Constructor and Description |
|---|
DefaultPersistencyBehavior(DiagramBehavior diagramBehavior)
Creates a new instance of
DefaultPersistencyBehavior that is
associated with the given DiagramBehavior. |
| Modifier and Type | Method and Description |
|---|---|
boolean |
isDirty()
Returns if the editor needs to be saved or not.
|
Diagram |
loadDiagram(org.eclipse.emf.common.util.URI uri)
This method is called to load the diagram into the editor.
|
void |
saveDiagram(IProgressMonitor monitor)
This method is called to save a diagram.
|
public DefaultPersistencyBehavior(DiagramBehavior diagramBehavior)
DefaultPersistencyBehavior that is
associated with the given DiagramBehavior.diagramEditor - the associated DiagramBehaviorpublic Diagram loadDiagram(org.eclipse.emf.common.util.URI uri)
TransactionalEditingDomain and
its ResourceSet to load an EMF Resource that holds the
Diagram. It will also enable modification tracking on the diagram
Resource.uri - the URI of the diagram to loadDiagram as it is resolved within the
editor, meaning as it is resolved within the editor's
TransactionalEditingDomain.public void saveDiagram(IProgressMonitor monitor)
DiagramBehavior so that the complete state of all modified
objects will be persisted in the file system.IRunnableWithProgress that cares about sending
only one Resource change event holding all modified files.
Besides also all adapters are temporarily switched off (see
DiagramBehavior.disableAdapters()).#save(TransactionalEditingDomain, Map).monitor - the Eclipse IProgressMonitor to use to report progresspublic boolean isDirty()
DiagramBehavior.isDirty() method. The default implementation
checks if the top of the current undo stack is equal to the stored top
command of the undo stack at the time of the last saving of the editor.true in case the editor needs to be saved,
false otherwise.