Interface ICustomUndoRedoFeature
-
- All Known Subinterfaces:
ICustomAbortableUndoRedoFeature
- All Known Implementing Classes:
AddFeatureForPattern,CreateConnectionFeatureForPattern,CreateFeatureForPattern,DefaultUpdateDiagramFeature,DeleteFeatureForPattern,DirectEditingFeatureForPattern,LayoutFeatureForPattern,MoveShapeFeatureForPattern,ReconnectionFeatureForPattern,RemoveFeatureForPattern,ResizeShapeFeatureForPattern,UpdateFeatureForPattern
public interface ICustomUndoRedoFeatureThis interface can by used and implemented by customers within any feature to signal the need for additional work that needs to be done before or after undo and redo. When a feature implements this interface, and the framework performs an undo or a redo, the framework will call the contained methods.Implementing this interface is especially helpful if customers want to implement undo/redo functionality for non-EMF changes, e.g. for non-EMF domain models. Note that any EMF-model change (including the changes done to the graphical representation (Graphiti
PictogramElements andGraphicsAlgorithms will by handled automatically by the Graphiti framework no matter if this interface is implemented by a feature or not. The feature may use the context object (e.g. the contained properties set) passed to the contained methods while executing the feature in order to collect any information needed for undo.In case you want to cancel undo/redo operations in
preUndo(IContext)/preRedo(IContext), you need to implementICustomAbortableUndoRedoFeaturewhich offers anICustomAbortableUndoRedoFeature.isAbort()method that causes the cancellation of undo/redo operation in casetrueis returned.- Since:
- 0.12
- See Also:
ICustomAbortableUndoRedoFeature
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description booleancanRedo(IContext context)Decides if the processed feature can be re-done.booleancanUndo(IContext context)Decides if the changes done by a processed feature can be undone.voidpostRedo(IContext context)This method will be called by the Graphiti framework after the EMF undo has finished.voidpostUndo(IContext context)This method will be called by the Graphiti framework after the EMF undo is finished.voidpreRedo(IContext context)This method will be called by the Graphiti framework before the EMF undo has triggered.voidpreUndo(IContext context)This method will be called by the Graphiti framework before the EMF undo is triggered.
-
-
-
Method Detail
-
canUndo
boolean canUndo(IContext context)
Decides if the changes done by a processed feature can be undone. This method is called once by the Graphiti framework just before any undo work is started, e.g. beforepreUndo(IContext).Note that as soon as any feature reports
falsehere, also all previous entries in the command stack are no longer reachable for undo.Note: this method with exactly the same signature is also already part of the
IFeaturecontract. It is repeated here for transparency purposes only.- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature.- Returns:
- true if the feature can be undone, false if not
-
preUndo
void preUndo(IContext context)
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 inpostUndo(IContext).- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature
-
postUndo
void postUndo(IContext context)
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 inpreUndo(IContext).- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature
-
canRedo
boolean canRedo(IContext context)
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. beforepreRedo(IContext).Note that as soon as any feature reports
falsehere, also all consecutive entries in the command stack are no longer reachable for redo.- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature- Returns:
- true if the feature can be re-done, false if not
-
preRedo
void preRedo(IContext context)
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 inpostRedo(IContext). (Usually it might be sufficient to delegate to the execution method of the feature.)- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature
-
postRedo
void postRedo(IContext context)
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 inpreRedo(IContext). (Usually it might be sufficient to delegate to the execution method of the feature.)- Parameters:
context- this is the instance of theIContextobject that was in use when executing the feature
-
-