public class DefaultUpdateBehavior extends PlatformObject implements org.eclipse.emf.edit.domain.IEditingDomainProvider, IOperationHistoryListener
IDiagramContainerUI
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 IDiagramContainerUI#createUpdateBehavior()
to return the
instance that shall be used.IDiagramContainerUI
.Constructor and Description |
---|
DefaultUpdateBehavior(DiagramBehavior diagramBehavior)
Creates a new
DefaultUpdateBehavior instance associated with the
given DiagramBehavior . |
Modifier and Type | Method and Description |
---|---|
void |
dispose()
Disposes this
DefaultUpdateBehavior and free all resources it
holds. |
org.eclipse.emf.transaction.TransactionalEditingDomain |
getEditingDomain()
This returns the editing domain as required by the
IEditingDomainProvider interface. |
void |
handleActivate()
Handles activation of the editor.
|
void |
historyNotification(OperationHistoryEvent event)
Is called by the operation history of the
TransactionalEditingDomain in case the history changes. |
void |
init()
Initializes listeners and adapters.
|
void |
setAdapterActive(boolean active)
Sets the flag that indicates if the
updateAdapter shall be
active of not (adapterActive ). |
void |
setEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain) |
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. |
getAdapter
public DefaultUpdateBehavior(DiagramBehavior diagramBehavior)
DefaultUpdateBehavior
instance associated with the
given DiagramBehavior
.diagramEditor
- the part this model editor works onpublic 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.public 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
).public void setAdapterActive(boolean active)
updateAdapter
shall be
active of not (adapterActive
).active
- the new value for the flagpublic org.eclipse.emf.transaction.TransactionalEditingDomain getEditingDomain()
IEditingDomainProvider
interface.getEditingDomain
in interface org.eclipse.emf.edit.domain.IEditingDomainProvider
TransactionalEditingDomain
that is used within this
editorpublic void init()
public 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()
.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.historyNotification
in interface IOperationHistoryListener
event
- the OperationHistoryEvent
to react uponpublic void setEditingDomain(org.eclipse.emf.transaction.TransactionalEditingDomain editingDomain)