Class DefaultUpdateDiagramFeature
java.lang.Object
org.eclipse.graphiti.features.impl.AbstractFeature
org.eclipse.graphiti.features.impl.AbstractUpdateFeature
org.eclipse.graphiti.features.impl.DefaultUpdateDiagramFeature
- All Implemented Interfaces:
ICustomAbortableUndoRedoFeature
,ICustomUndoRedoFeature
,IFeature
,IFeatureProviderHolder
,IUpdateFeature
,IUpdate
,IDescription
,IName
public class DefaultUpdateDiagramFeature
extends AbstractUpdateFeature
implements ICustomAbortableUndoRedoFeature
The Class DefaultUpdateDiagramFeature. Updates the shapes directly contained
in the diagram. Does not update the connections contained in the diagram,
since in many cases the connections get already updated by the shapes they
belong to.
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Decides if the processed feature can be re-done.boolean
Decides if the current feature can be undone - this is the undo of the execute operation.boolean
canUpdate
(IUpdateContext context) Checks whether the values of the current pictogram element of the given context can be updated.protected Map<IUpdateFeature,
IUpdateContext> findFeaturesToUpdateChildren
(PictogramElement pe, boolean checkUpdateNeeded) boolean
Is queried by the framework after a feature has been executed to find out if this feature should appear in the undo stack of e.g.boolean
isAbort()
The Graphiti framework will call this method afterICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext)
/ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext)
have been called and before the actual undo/redo operation is triggered.void
This method will be called by the Graphiti framework after the EMF undo has finished.void
This method will be called by the Graphiti framework after the EMF undo is finished.void
This method will be called by the Graphiti framework before the EMF undo has triggered.void
This method will be called by the Graphiti framework before the EMF undo is triggered.boolean
update
(IUpdateContext context) Updates the pictogram element.updateNeeded
(IUpdateContext context) Check whether the values in the pictogram element are up to date, that means whether the graphics algorithm of this pictogram element contain the latest values from the business objects.Methods inherited from class org.eclipse.graphiti.features.impl.AbstractUpdateFeature
canExecute, canUpdatePictogramElement, execute, getDescription, getName, resizeShape, updatePictogramElement, updatePictogramElementNeeded
Methods inherited from class org.eclipse.graphiti.features.impl.AbstractFeature
addGraphicalRepresentation, getAllBusinessObjectsForPictogramElement, getBusinessObjectForPictogramElement, getDiagram, getDiagramBehavior, getFeatureProvider, getProgressCallback, getUserDecision, isAvailable, layoutPictogramElement, link, link, manageColor, manageColor, manageDefaultFont, manageFont, manageFont, setProgressCallback, toString
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface org.eclipse.graphiti.features.IFeature
isAvailable
Methods inherited from interface org.eclipse.graphiti.features.IFeatureProviderHolder
getFeatureProvider
-
Constructor Details
-
DefaultUpdateDiagramFeature
Creates a newDefaultUpdateDiagramFeature
.- Parameters:
fp
- the feature provider
-
-
Method Details
-
canUpdate
Description copied from interface:IUpdate
Checks whether the values of the current pictogram element of the given context can be updated. -
update
Description copied from interface:IUpdate
Updates the pictogram element. It copies the latest values from the business model to the graphics algorithm of this pictogram elements. -
updateNeeded
Description copied from interface:IUpdate
Check whether the values in the pictogram element are up to date, that means whether the graphics algorithm of this pictogram element contain the latest values from the business objects.- Specified by:
updateNeeded
in interfaceIUpdate
- Parameters:
context
- the context- Returns:
- true if parts of the pictogram model needs to be updated with the latest values from the business model
-
hasDoneChanges
public boolean hasDoneChanges()Description copied from interface:IFeature
Is queried by the framework after a feature has been executed to find out if this feature should appear in the undo stack of e.g. an editor. By default all features should appear there (see implementation inAbstractFeature
), but features may decide to override this behavior. Note that this is a dynamic attribute of the feature that is queried each time after the feature has been executed.IMPORTANT NOTE: The implementor of the feature is responsible for correctly implementing this method! It might lead to inconsistencies in the command stack if this method returns
false
although the feature did changes.- Specified by:
hasDoneChanges
in interfaceIFeature
- Overrides:
hasDoneChanges
in classAbstractFeature
- Returns:
true
if the feature should appear in the undo stack,false
otherwise
-
canUndo
Description copied from interface:IFeature
Decides if the current feature can be undone - this is the undo of the execute operation.- Specified by:
canUndo
in interfaceICustomUndoRedoFeature
- Specified by:
canUndo
in interfaceIFeature
- Overrides:
canUndo
in classAbstractFeature
- Parameters:
context
- this is the general input for this method- Returns:
- true if the feature can be undone, false if not
- Since:
- 0.12
- See Also:
-
preUndo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework before the EMF undo is triggered. Customers may revert their non-EMF changes done by the feature here or inICustomUndoRedoFeature.postUndo(IContext)
.- Specified by:
preUndo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
postUndo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework after the EMF undo is finished. Customers may revert their non-EMF changes done by the feature here or inICustomUndoRedoFeature.preUndo(IContext)
.- Specified by:
postUndo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
canRedo
Description copied from interface:ICustomUndoRedoFeature
Decides if the processed feature can be re-done. This method is called once by the Graphiti framework just before any redo work is started, e.g. beforeICustomUndoRedoFeature.preRedo(IContext)
.Note that as soon as any feature reports
false
here, also all consecutive entries in the command stack are no longer reachable for redo.- Specified by:
canRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Returns:
- true if the feature can be re-done, false if not
- Since:
- 0.12
-
preRedo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework before the EMF undo has triggered. Customers may re-apply their non-EMF changes done by the feature here or inICustomUndoRedoFeature.postRedo(IContext)
. (Usually it might be sufficient to delegate to the execution method of the feature.)- Specified by:
preRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
postRedo
Description copied from interface:ICustomUndoRedoFeature
This method will be called by the Graphiti framework after the EMF undo has finished. Customers may re-apply their non-EMF changes done by the feature here or inICustomUndoRedoFeature.preRedo(IContext)
. (Usually it might be sufficient to delegate to the execution method of the feature.)- Specified by:
postRedo
in interfaceICustomUndoRedoFeature
- Parameters:
context
- this is the instance of theIContext
object that was in use when executing the feature- Since:
- 0.12
-
isAbort
public boolean isAbort()Description copied from interface:ICustomAbortableUndoRedoFeature
The Graphiti framework will call this method afterICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext)
/ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext)
have been called and before the actual undo/redo operation is triggered. In case this method returnstrue
, the operation will be cancelled by the Graphiti framework by throwing anOperationCanceledException
that causes am EMF revert of the operation.Implementing classes might e.g. set a flag in
ICustomUndoRedoFeature.preUndo(org.eclipse.graphiti.features.context.IContext)
/ICustomUndoRedoFeature.preRedo(org.eclipse.graphiti.features.context.IContext)
as cancellation indication and check that that flag here.- Specified by:
isAbort
in interfaceICustomAbortableUndoRedoFeature
- Returns:
true
in case you want to cancel the current operation,false
otherwise.- Since:
- 0.12
-
findFeaturesToUpdateChildren
protected Map<IUpdateFeature,IUpdateContext> findFeaturesToUpdateChildren(PictogramElement pe, boolean checkUpdateNeeded) - Since:
- 0.12
-