|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectorg.eclipse.graphiti.ui.editor.DefaultPersistencyBehavior
public class DefaultPersistencyBehavior
The default implementation for the 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.
Note that there is always a 1:1 relation with a DiagramBehavior.
| Nested Class Summary | |
|---|---|
protected class |
DefaultPersistencyBehavior.SaveException
|
protected class |
DefaultPersistencyBehavior.SaveOperation
The workspace operation used to do the actual save. |
| Field Summary | |
|---|---|
protected DiagramBehavior |
diagramBehavior
The associated DiagramBehavior |
protected Command |
savedCommand
Used to store the command that was executed before the editor was saved. |
| Constructor Summary | |
|---|---|
DefaultPersistencyBehavior(DiagramBehavior diagramBehavior)
Creates a new instance of DefaultPersistencyBehavior that is
associated with the given DiagramBehavior. |
|
| Method Summary | |
|---|---|
private DefaultPersistencyBehavior.SaveException |
createException(Map<URI,Throwable> failedSaves)
|
protected IRunnableWithProgress |
createOperation(Set<Resource> savedResources,
Map<Resource,Map<?,?>> saveOptions)
Creates the runnable to be used to wrap the actual saving of the EMF Resources.To only modify the actual saving clients should rather override #save(TransactionalEditingDomain, Map). |
protected Map<Resource,Map<?,?>> |
createSaveOptions()
Returns the EMF save options to be used when saving the EMF Resources. |
boolean |
isDirty()
Returns if the editor needs to be saved or not. |
Diagram |
loadDiagram(URI uri)
This method is called to load the diagram into the editor. |
protected Set<Resource> |
save(TransactionalEditingDomain editingDomain,
Map<Resource,Map<?,?>> saveOptions,
IProgressMonitor monitor)
Saves all resources in the given TransactionalEditingDomain. |
void |
saveDiagram(IProgressMonitor monitor)
This method is called to save a diagram. |
protected void |
setDiagramVersion(Diagram diagram)
Called in saveDiagram(IProgressMonitor) to update the Graphiti
diagram version before saving a diagram. |
protected boolean |
shouldSave(Resource resource)
Checks whether a resource should be save during the diagram save process. |
protected void |
showSaveError(IStatus status)
|
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final DiagramBehavior diagramBehavior
DiagramBehavior
protected Command savedCommand
| Constructor Detail |
|---|
public DefaultPersistencyBehavior(DiagramBehavior diagramBehavior)
DefaultPersistencyBehavior that is
associated with the given DiagramBehavior.
diagramEditor - the associated DiagramBehavior| Method Detail |
|---|
public Diagram loadDiagram(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 load
Diagram 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.protected Map<Resource,Map<?,?>> createSaveOptions()
Resources.
Map object holding the used EMF save options.
protected IRunnableWithProgress createOperation(Set<Resource> savedResources,
Map<Resource,Map<?,?>> saveOptions)
Resources.#save(TransactionalEditingDomain, Map).
savedResources - this parameter will after the operation has been performed
contain all EMF Resources that have really been saved.saveOptions - the EMF save options to use.
IRunnableWithProgress instance wrapping the actual
save process.
protected Set<Resource> save(TransactionalEditingDomain editingDomain,
Map<Resource,Map<?,?>> saveOptions,
IProgressMonitor monitor)
TransactionalEditingDomain. Can
be overridden to enable additional (call the super method to save the EMF
resources) or other persistencies.
editingDomain - the TransactionalEditingDomain for which all resources
will be savedsaveOptions - the EMF save options used for the saving.monitor - The progress monitor to use for reporting progress
Set of all EMF Resources that were actually
saved.private DefaultPersistencyBehavior.SaveException createException(Map<URI,Throwable> failedSaves)
protected void setDiagramVersion(Diagram diagram)
saveDiagram(IProgressMonitor) to update the Graphiti
diagram version before saving a diagram. Currently the diagram version is
set to 0.13.0
diagram - the Diagram to update the version attribute forprotected boolean shouldSave(Resource resource)
resource - the Resource to check
protected void showSaveError(IStatus status)
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||