For an easier imaplementation of do-undo-commands some syntactic sugar would be nice that allows me to define for each command a corresponding undo command - just like this:
// class field
private Stack commandStack = new Stack<>()
public void doASpecificOperationThatAllowsUndoing() {
Command doCommand = new DelegateCommand(() -> executeAnOperation);
Command undoCommand = new DelegateCommand(() -> executeAnInverseOperation);
CommandPair undoCommandPair = new CommandPair(doCommand, undoCommand);
undoCommandPair.do();
commandStack.push(undoCommandPair);
}
public void undoLastOperation() {
commandStack.pop().undo();
}
This would be really cool. Maybe I have missed an information from the wiki, but I did not spot any stuff like this.
For an easier imaplementation of do-undo-commands some syntactic sugar would be nice that allows me to define for each command a corresponding undo command - just like this:
This would be really cool. Maybe I have missed an information from the wiki, but I did not spot any stuff like this.