I was able to successfully use the undo manager in my graphics application, by following this example
It works great when I just create graphics and delete them with the undo button.
Now I ran into the following problem. In my application you can right-click a graphic and then delete it. This throws off my undo / redo button, since it only works if the "deletion" goes linear How would I handle a case like this?
I was playing with the undoManager.remove() method by also removing the specific graphic from the operation. But then I didn't know what to do if I want to get it back.