Closed JordanMartinez closed 8 years ago
Exactly.
Still, it was a good mental exercise for me. :-)
At least you got something out of it, heh :D
At least you got something out of it, heh :D
Well I'm never going to learn and grow if I don't try to do something challenging :D "Failing" is learning, not failing.
That's the right attitude :+1:
Truth be told, this approach is more like an UndoManager for a Single use case (LinearUndoManager) and an "wrapper" UndoManager (NonLinearUndoManager) designed to be shared by multiple objects, with each object having its own ChangeQueue. However, it's not something that would work for a directed acyclic graph.
Let's use RichTextFX as an example. Let's say there are two areas whose content starts with
text
as its initial text. Then, the user insertssomeText
into one area, thus making it's nextundo()
call an action that will remove that text. Third, the user deletes the content's text in the second area. Fourth, the user undoes the first area's insertion (removessomeText
). This fourth step would throw an Exception of some sort because it cannot delete text that is no longer there.