|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectPlatformObject
org.eclipse.graphiti.ui.editor.DefaultUpdateBehavior
public class DefaultUpdateBehavior
The default implementation for the DiagramEditor behavior extension
that controls update behavior of the editor and defines the EMF adapters that
watch over model object modifications. Clients may subclass to change the
behavior; use DiagramEditor.createUpdateBehavior() to return the
instance that shall be used.
Note that there is always a 1:1 relation with a DiagramEditor.
| Field Summary | |
|---|---|
private boolean |
adapterActive
Flag that indicates if the updateAdapter shall be active or not. |
protected DiagramEditor |
diagramEditor
The associated DiagramEditor |
private TransactionalEditingDomain |
editingDomain
The editing domain that is used throughout the DiagramEditor is
kept here and only here. |
private ElementDeleteListener |
elementDeleteListener
Closes editor if model object is deleted. |
private boolean |
resourceChanged
Is toggled by updateAdapter. |
private boolean |
resourceDeleted
Is toggled by updateAdapter. |
private ResourceSetUpdateAdapter |
resourceSetUpdateAdapter
The update adapter is added to every Resource adapters in the
ResourceSet of the TransactionalEditingDomain. |
private Adapter |
updateAdapter
The default update that cares about refreshing the diagram editor in case of resource changes. |
private WorkspaceSynchronizer |
workspaceSynchronizer
|
| Constructor Summary | |
|---|---|
DefaultUpdateBehavior(DiagramEditor diagramEditor)
Creates a new DefaultUpdateBehavior instance associated with the
given DiagramEditor. |
|
| Method Summary | |
|---|---|
private void |
closeEditor()
|
protected void |
createEditingDomain()
Created the TransactionalEditingDomain that shall be used within
the diagram editor and initializes it by delegating to
initializeEditingDomain(TransactionalEditingDomain). |
void |
dispose()
Disposes this DefaultUpdateBehavior and free all resources it
holds. |
protected void |
disposeEditingDomain()
Cares about disposing the TransactionalEditingDomain held in this
instance. |
TransactionalEditingDomain |
getEditingDomain()
This returns the editing domain as required by the IEditingDomainProvider interface. |
private IOperationHistory |
getOperationHistory()
|
private Shell |
getShell()
|
void |
handleActivate()
Handles activation of the editor. |
protected void |
handleChangedResources()
Handles what to do with changed resources on editor activation. |
protected boolean |
handleDirtyConflict()
Shows a dialog that asks if conflicting changes should be discarded or not. |
void |
historyNotification(OperationHistoryEvent event)
Is called by the operation history of the TransactionalEditingDomain in case the history changes. |
void |
init()
Initializes listeners and adapters. |
protected void |
initializeEditingDomain(TransactionalEditingDomain domain)
This sets up the editing domain for this model editor. |
protected boolean |
isAdapterActive()
Returns the flag that indicates if the updateAdapter shall be
active of not (adapterActive). |
protected boolean |
isResourceChanged()
Returns the flag that indicates if the underlying resource of the Diagram has been changed. |
protected boolean |
isResourceDeleted()
Returns the flag that indicates if the underlying resource of the Diagram has been deleted. |
void |
setAdapterActive(boolean active)
Sets the flag that indicates if the updateAdapter shall be
active of not (adapterActive). |
void |
setResourceChanged(boolean resourceChanged)
Sets the flag that indicates if the underlying resource of the Diagram has been changed. |
void |
setResourceDeleted(boolean resourceDeleted)
Sets the flag that indicates if the underlying resource of the Diagram has been deleted. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected final DiagramEditor diagramEditor
DiagramEditor
private TransactionalEditingDomain editingDomain
DiagramEditor is
kept here and only here.
private ElementDeleteListener elementDeleteListener
private ResourceSetUpdateAdapter resourceSetUpdateAdapter
Resource adapters in the
ResourceSet of the TransactionalEditingDomain. When
notified, it adds an updateAdapter to the
adapters of the ResourceSet.
initializeEditingDomain(TransactionalEditingDomain)private boolean resourceDeleted
updateAdapter.
private boolean resourceChanged
updateAdapter.
private WorkspaceSynchronizer workspaceSynchronizer
private boolean adapterActive
updateAdapter shall be active or not.
It may be deactivated when mass operations (e.g. saving the diagram
editor with all its resources) take place. Use the methods
isAdapterActive() and setAdapterActive(boolean) to
access this field.
private Adapter updateAdapter
isAdapterActive() and returning false.
| Constructor Detail |
|---|
public DefaultUpdateBehavior(DiagramEditor diagramEditor)
DefaultUpdateBehavior instance associated with the
given DiagramEditor.
diagramEditor - the part this model editor works on| Method Detail |
|---|
protected boolean isResourceDeleted()
Diagram has been deleted. Note that this flag will only be
updated in case the updateAdapter is enabled, see
adapterActive, isAdapterActive() and
setAdapterActive(boolean). If this flag is set the editor will
close on receiving the next event.
true in case the resource has been deleted,
false otherwisepublic void setResourceDeleted(boolean resourceDeleted)
Diagram has been deleted. Note that this flag should only be
updated by the updateAdapter, see adapterActive,
isAdapterActive() and setAdapterActive(boolean).
Should not be called by external clients.
resourceDeleted - the value to set the flag to, true indicates that
the resource has been deleted.protected boolean isResourceChanged()
Diagram has been changed. Note that this flag will only be
updated in case the updateAdapter is enabled, see
adapterActive, isAdapterActive() and
setAdapterActive(boolean).
true in case the resource has been changed,
false otherwisepublic void setResourceChanged(boolean resourceChanged)
Diagram has been changed. Note that this flag should only be
updated by the updateAdapter, see adapterActive,
isAdapterActive() and setAdapterActive(boolean).
Should not be called by external clients.
resourceChanged - the value to set the flag to, true indicates that
the resource has been changed.public void handleActivate()
resourceDeleted is true)
the editor will be closed after a call to handleDirtyConflict()
that returns true. Also it will call
handleChangedResources() in case the underlying diagram resource
has changed (resourceChanged is true).
protected boolean isAdapterActive()
updateAdapter shall be
active of not (adapterActive). In case this method returns
false, the updateAdapter will do nothing on being
called.
true in case the adapter shall run,
false otherwise.public void setAdapterActive(boolean active)
updateAdapter shall be
active of not (adapterActive).
active - the new value for the flagprotected void handleChangedResources()
protected boolean handleDirtyConflict()
handleActivate().
true in case the editor shall be closed,
false otherwisepublic TransactionalEditingDomain getEditingDomain()
IEditingDomainProvider interface.
TransactionalEditingDomain that is used within this
editorpublic void init()
protected void createEditingDomain()
TransactionalEditingDomain that shall be used within
the diagram editor and initializes it by delegating to
initializeEditingDomain(TransactionalEditingDomain).
protected void initializeEditingDomain(TransactionalEditingDomain domain)
domain - The TransactionalEditingDomain that is used within
this model editorpublic void dispose()
DefaultUpdateBehavior and free all resources it
holds. In case you only want to omit or influence the disposal of the
TransactionalEditingDomain, you can also override
disposeEditingDomain().
protected void disposeEditingDomain()
TransactionalEditingDomain held in this
instance. Is called during the dispose() method.
public void historyNotification(OperationHistoryEvent event)
TransactionalEditingDomain in case the history changes. Reacts on
undo and redo events and updates the dirty state of the editor.
event - the OperationHistoryEvent to react uponprivate Shell getShell()
private void closeEditor()
private IOperationHistory getOperationHistory()
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||