在我的 RCP - 项目中,我使用 eclipse 数据绑定将 ui 与后端连接起来。我希望打开的编辑器中的每个更改都是不可撤销的。我的 Domainmodell 和 UI 分开在两个不同的插件中。
我当前的方法是为数据绑定实现我自己的 UpdateValueStrategy 类。我扩展了正常的 UpdateValueStrategy 并重写了 doSet 方法。
从那里我得到了OperationHistory和Global UndoContext,然后我创建了一个新的操作。我有各种操作,例如“ChangeCustomerName”和“ChangeCustomerNote”。
问题:
- 我是否需要自己实现撤消/重做逻辑,或者框架是否以某种方式支持我这样做?
- 有没有比 UpdateValue - Strategy 类的 doSet() 更好的地方或方法来创建可撤消的操作。要访问已更改的文本字段并不容易。
in my RCP - Project i'm using eclipse databinding to connect the ui with the backend. I want every change in an open editor to be undoable. My Domainmodell and UI are seperated in two different plugins.
My current approach is to implement my own UpdateValueStrategy class for the databinding. I extend the normal UpdateValueStrategy and override the doSet Methode.
From there i get the OperationHistory and the Global UndoContext, then i create a new Operation. I have various Operations like "ChangeCustomerName" and "ChangeCustomerNote".
Questions:
- Do i need to implement the undo/redo - logic by my own, or is the framework somehow supporting my with this?
- Is there a better place or way to create the undoable Operation then the doSet() of the UpdateValue - Strategy class. To access the textfield, which was changed is not to easy.
发布评论
评论(1)
您将得到的大部分答案是:使用 EMF.Edit,它包含了开箱即用的 org.eclipse.emf.databinding.edit,并且有一个出色的 教程在网上。
Eclipse bugtracker 中有一个关于包含撤消/重做的开放功能请求也在没有 EMF 的 JFace 数据绑定中,但它还没有完成。它也在 eclipse 论坛中进行了讨论。
The answer you will get mostly is: Use EMF.Edit, it includes it out of the box with org.eclipse.emf.databinding.edit and there's an excellent tutorial on the net.
There is an open feature request in the Eclipse bugtracker about including undo/redo also in JFace databinding without EMF but it's not finished yet. It has also be discussed in the eclipse forum.