Class. Command Stack
protectedmodelFactory:IModelFactory
Defined in: packages/sprotty/src/base/commands/command-stack.ts:106
protectedoptionalmodelViewer:IViewer
Defined in: packages/sprotty/src/base/commands/command-stack.ts:114
protectedoffStack:ICommand[] =[]
Defined in: packages/sprotty/src/base/commands/command-stack.ts:138
System commands should be transparent to the user in undo/redo operations. When a system command is executed when the redo stack is not empty, it is pushed to offStack instead.
On redo, all commands form this stack are undone such that the redo operation gets the exact same model as when it was executed first.
On undo, all commands form this stack are undone as well as system ommands should be transparent to the user.
protectedoptions:CommandStackOptions
Defined in: packages/sprotty/src/base/commands/command-stack.ts:110
protectedoptionalpopupModelViewer:IViewer
Defined in: packages/sprotty/src/base/commands/command-stack.ts:116
protectedredoStack:ICommand[] =[]
Defined in: packages/sprotty/src/base/commands/command-stack.ts:119
protectedstoppableCommands:Map<string,IStoppableCommand>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:124
Map which holds the last stoppable command for certain action kinds.
protectedsyncer:AnimationFrameSyncer
Defined in: packages/sprotty/src/base/commands/command-stack.ts:109
protectedundoStack:ICommand[] =[]
Defined in: packages/sprotty/src/base/commands/command-stack.ts:118
protectedviewerProvider:IViewerProvider
Defined in: packages/sprotty/src/base/commands/command-stack.ts:107
get
protectedcurrentModel():Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:158
Promise<SModelRootImpl>
protectedcreateContext(currentModel):CommandExecutionContext
Defined in: packages/sprotty/src/base/commands/command-stack.ts:427
Assembles the context object that is passed to the commands execution method.
execute(
command):Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:174
Executes the given command on the current model and returns a Promise for the new result.
Unless it is a special command, it is pushed to the undo stack such that it can be rolled back later and the redo stack is cleared.
Promise<SModelRootImpl>
executeAll(
commands):Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:164
Executes all of the given commands. As opposed to calling execute() multiple times, the Viewer is only updated once after the last command has been executed.
ICommand[]
Promise<SModelRootImpl>
protectedhandleCommand(command,operation,beforeResolve):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:215
Chains the current promise with another Promise that performs the given operation on the given command.
(context) => CommandReturn
(command, context) => void
a function that is called directly before resolving the Promise to return the new model. Usually puts the command on the appropriate stack.
void
protectedinitialize():void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:141
void
protectedisBlockUndo(command):boolean
Defined in: packages/sprotty/src/base/commands/command-stack.ts:446
boolean
protectedisPushToOffStack(command):boolean
Defined in: packages/sprotty/src/base/commands/command-stack.ts:438
boolean
protectedisPushToUndoStack(command):boolean
Defined in: packages/sprotty/src/base/commands/command-stack.ts:442
boolean
protectedmergeOrPush(command,context):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:348
Handling of commands after their execution.
Hidden commands are not pushed to any stack.
System commands are pushed to the offStack when the redo
stack is not empty, allowing to undo the before a redo to keep the chain
of commands consistent.
Mergable commands are merged if possible.
void
protectedpushToUndoStack(command):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:274
void
redo():
Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:194
Takes the topmost command from the redo stack, redoes its changes and pushes it ot the undo stack. Returns a Promise for the changed model.
Promise<SModelRootImpl>
protectedredoFollowingSystemCommands():void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:412
System commands should be transparent to the user, so this method
is called from redo() to re-execute all system commands
at the top of the redoStack.
void
protectedthenUpdate():Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:284
Notifies the Viewer to render the new model and/or the new hidden model and returns a Promise for the new model.
Promise<SModelRootImpl>
undo():
Promise<SModelRootImpl>
Defined in: packages/sprotty/src/base/commands/command-stack.ts:180
Takes the topmost command from the undo stack, undoes its changes and pushes it ot the redo stack. Returns a Promise for the changed model.
Promise<SModelRootImpl>
protectedundoOffStackSystemCommands():void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:381
Reverts all system commands on the offStack.
void
protectedundoPreceedingSystemCommands():void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:395
System commands should be transparent to the user, so this method
is called from undo() to revert all system commands
at the top of the undoStack.
void
update(
model,cause?):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:310
Notify the ModelViewer that the model has changed.
Action
void
updateHidden(
model,cause?):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:320
Notify the HiddenModelViewer that the hidden model has changed.
Action
void
updatePopup(
model,cause?):void
Defined in: packages/sprotty/src/base/commands/command-stack.ts:330
Notify the PopupModelViewer that the popup model has changed.
Action
void