Package org.eclipse.graphiti.ui.editor
Class DefaultRefreshBehavior
java.lang.Object
org.eclipse.graphiti.ui.editor.DefaultRefreshBehavior
The default implementation for the
Note that there is always a 1:1 relation with a
DiagramBehavior
behavior extension
that controls the refresh behavior of the Graphiti diagram editor. Clients
may subclass to change the behavior; use
DiagramBehavior.createRefreshBehavior()
to return the instance that
shall be used.Note that there is always a 1:1 relation with a
DiagramBehavior
.- Since:
- 0.9
-
Field Summary
-
Constructor Summary
ConstructorDescriptionDefaultRefreshBehavior
(DiagramBehavior diagramBehavior) Creates a new standard refresh behaviour for a Graphiti diagram editor. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
Handles the auto update of the editor and triggers an update of theDiagram
by delegating to theIUpdateFeature
registered for theDiagram
.void
Handles the auto update at rest of the editor (the editor performs a reload of the EMF resources because e.g.void
Handles the auto update at startup of the editor and is called by the GraphitiDiagramBehavior
when the input is set (DiagramBehavior#setInput(org.eclipse.ui.IEditorInput)
).void
Initializes the performance cache and is called by the Graphiti framework before a refresh is triggered.void
internalRefreshEditPart
(org.eclipse.gef.EditPart editPart) Internal refresh of a givenEditPart
.boolean
Returns if auto refresh is enabled or not.boolean
Returns if multiple refreshes shall be omitted and a bundled refresh should happen instead.void
refresh()
Does the refresh of the editor, so that the UI reflects the current state of the Graphiti pictograms model.protected void
Refreshes the givenPictogramElement
so that the UI reflects the current state in the Graphiti pictograms model.void
Refreshes all rendering decorators for the givenPictogramElement
as defined inIToolBehaviorProvider.getDecorators(PictogramElement)
.void
setAutoRefresh
(boolean autoRefresh) Auto refresh can be enabled or disabled with this function.In case it is enabled the editor will automatically react on EMF resource changes.boolean
shouldRefresh
(Object obj) Checks the performance cache if a refresh shall be triggered for the given object.
-
Field Details
-
diagramBehavior
The associatedDiagramBehavior
. Set on construction of this class.- Since:
- 0.10
-
-
Constructor Details
-
DefaultRefreshBehavior
Creates a new standard refresh behaviour for a Graphiti diagram editor. The passedDiagramBehavior
is closely linked to this instance (1:1 relation) and both instances will have a common lifecycle.- Parameters:
diagramEditor
- The associatedDiagramBehavior
.- Since:
- 0.10
-
-
Method Details
-
initRefresh
public void initRefresh()Initializes the performance cache and is called by the Graphiti framework before a refresh is triggered. Should not be called by clients.- Since:
- 0.9
-
handleAutoUpdateAtStartup
public void handleAutoUpdateAtStartup()Handles the auto update at startup of the editor and is called by the GraphitiDiagramBehavior
when the input is set (DiagramBehavior#setInput(org.eclipse.ui.IEditorInput)
). The default implementation checks the desired behavior as defined inIDiagramTypeProvider.isAutoUpdateAtStartup()
and calls#autoUpdate(Diagram, IDiagramTypeProvider)
in case an update shall be done.- Since:
- 0.12 originally introduced with Graphiti 0.9
-
handleAutoUpdateAtReset
public void handleAutoUpdateAtReset()Handles the auto update at rest of the editor (the editor performs a reload of the EMF resources because e.g. the underlying file has been changed by another editor) and is called by the GraphitiDiagramBehavior
after theDiagram
has been reloaded. The default implementation checks the desired behavior as defined inIDiagramTypeProvider.isAutoUpdateAtReset()
and calls#autoUpdate(Diagram, IDiagramTypeProvider)
in case an update shall be done.- Since:
- 0.12 originally introduced with Graphiti 0.9
-
autoUpdate
protected void autoUpdate()Handles the auto update of the editor and triggers an update of theDiagram
by delegating to theIUpdateFeature
registered for theDiagram
. In the endrefresh()
is called to reflect the update in the editor UI. This method is called byhandleAutoUpdateAtStartup()
andhandleAutoUpdateAtReset()
.- Since:
- 0.9
-
refresh
public void refresh()Does the refresh of the editor, so that the UI reflects the current state of the Graphiti pictograms model. Also the editor title is updated; in case direct editing is active it is cancelled. -
refresh
Refreshes the givenPictogramElement
so that the UI reflects the current state in the Graphiti pictograms model.- Parameters:
pe
- thePictogramElement
to refresh
-
refreshRenderingDecorators
Refreshes all rendering decorators for the givenPictogramElement
as defined inIToolBehaviorProvider.getDecorators(PictogramElement)
.- Parameters:
pe
- thePictogramElement
to refresh the decorators for
-
internalRefreshEditPart
public void internalRefreshEditPart(org.eclipse.gef.EditPart editPart) Internal refresh of a givenEditPart
.- Parameters:
editPart
- the edit part to refresh
-
isAutoRefresh
public boolean isAutoRefresh()Returns if auto refresh is enabled or not. In case it is enabled the editor will automatically react on EMF resource changes.By default the auto refresh is turned on so this method returns
true
.- Returns:
- true, if is auto refresh
-
setAutoRefresh
public void setAutoRefresh(boolean autoRefresh) Auto refresh can be enabled or disabled with this function.In case it is enabled the editor will automatically react on EMF resource changes.By default the auto refresh is turned on.
- Parameters:
autoRefresh
- the new value of auto refresh- Since:
- 0.14
-
isMultipleRefreshSupressionActive
public boolean isMultipleRefreshSupressionActive()Returns if multiple refreshes shall be omitted and a bundled refresh should happen instead. Is called by the framework on creation and refreshing ofFigure
s.The default implementation simply returns
true
. Note: returning false here might have large performance implications, so use this option only with extra care!- Returns:
-
shouldRefresh
Checks the performance cache if a refresh shall be triggered for the given object. Should not be called by external clients.- Since:
- 0.9
-