Part of my project is to write a text editor that is used for typing some rules, compiling my application and running it. Writing compiler was end and release beta version.
Here is a snippet that shows how SWT supports Undo/Redo operations. Take it as practical example (or use it directly, if your editor is based on SWT):
SWT Undo Redo