Possible Duplicate:
Design Pattern for Undo Engine
In general, how do you deal with supporting an “undo” feature in your application? I have worked on web apps and desktop apps alike, and I have never really felt comfortable with any “undo” system I’ve made.
I believe it should be Command design pattern.
Here is article about multilevel Undo/Redo with Command pattern.
EDIT: Here is second about multilevel Undo/Redo with Memento pattern.
So probably it can be done with both.