Search code examples
javaeclipse-rcpe4undo-redo

Undo redo in Eclipse E4


I'm searching for a good way to implement undo and redo functionality in an Eclipse E4 application. The undo-redo function need to be undo all the changes of the user on the current MPart. In that MPart it can be on a table change, field change, ...

I have currently three different handlers to execute a insert, update or delete action. All of those handlers implements a interface with methods execute, undo and redo. Are there some default Eclipse Handlers to undo an action provided in some other handlers? So in other words an button in the toolbar that dynamically call the undomanager (object that manages the actions of that specific MPart) of that specific MPart.


Solution

  • I used two buttons on the toolbar to undo or redo some actions from a specific MPart.

    The undo and redo functions are in an Interface and need to be implemented in all the action classes.

    The implementation is based on this example: http://www.algosome.com/articles/implementing-undo-redo-java.html