简体   繁体   English

在 Eclipse E4 中撤消重做

[英]Undo redo in Eclipse E4

I'm searching for a good way to implement undo and redo functionality in an Eclipse E4 application.我正在寻找一种在 Eclipse E4 应用程序中实现撤消和重做功能的好方法。 The undo-redo function need to be undo all the changes of the user on the current MPart. undo-redo 功能需要撤销用户对当前 MPart 的所有更改。 In that MPart it can be on a table change, field change, ...在该 MPart 中,它可以是表更改、字段更改、...

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?是否有一些默认的 Eclipse 处理程序可以撤消其他处理程序中提供的操作? 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.因此,换句话说,工具栏中的按钮动态调用该特定 MPart 的取消管理器(管理该特定 MPart 的操作的对象)。

I used two buttons on the toolbar to undo or redo some actions from a specific MPart.我使用工具栏上的两个按钮来撤消或重做来自特定 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实现基于这个例子: http : //www.algosome.com/articles/implementing-undo-redo-java.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM