FXMisc / UndoFX

Undo manager for JavaFX
BSD 2-Clause "Simplified" License
99 stars 17 forks source link

Implement a Linear & NonLinear UndoManager #9

Closed JordanMartinez closed 8 years ago

JordanMartinez commented 8 years ago

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 inserts someText into one area, thus making it's next undo() 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 (removes someText). This fourth step would throw an Exception of some sort because it cannot delete text that is no longer there.

TomasMikula commented 8 years ago

Exactly.

JordanMartinez commented 8 years ago

Still, it was a good mental exercise for me. :-)

TomasMikula commented 8 years ago

At least you got something out of it, heh :D

JordanMartinez commented 8 years ago

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.

TomasMikula commented 8 years ago

That's the right attitude :+1: