Undo/Redo model property [message #1732832] |
Fri, 20 May 2016 14:46 |
Nemanja Bjelica Messages: 14 Registered: October 2015 |
Junior Member |
|
|
Hi guys,
I'm new to the GEF4. I've created an editor with two different shapes, and I've added a property view with several options such as position, length etc...
Now, when I change the property, I want to be able to undo it. I've added OnType policy and binded keyboard shortcuts for undo/redo (in a similar fashion as http://fbenoit.blogspot.rs/2015/11/gef4-tutorial-part-6-undo-redo.html), but I can't undo property change.
Can someone try to explain how this can be done? I'm looking at the Logo example and I've done pretty much the same design for firing property change events, updating the model etc., but I'm missing a step. Do I have to create SetPropertyValueOperation (can't find it in Logo example) and call its execute method to put it on the operation stack or is this something that GEF does by itself?
Thanks,
Beli
|
|
|
|
Re: Undo/Redo model property [message #1732988 is a reply to message #1732832] |
Mon, 23 May 2016 14:46 |
Nemanja Bjelica Messages: 14 Registered: October 2015 |
Junior Member |
|
|
Alexander, thanks for reply, I really appreciate your time.
I didn't mention, I'am using an old version, 0.1.0201506081138. I've looked into classes you mention. Basically, I've added piece of code (where property sheet page is created) from FXEditor - getAdapter method, into my editor.
Also, I've looked into MvcUiModule also, but I can't successfully call bindIPropertySheetPageFactory with old version of the code. Currently, I have an empty properties view and I don't know how to link it with my properties.
Is there a way to achieve this undo/redo mechanism for properties with the version I have? Could you provide me with some steps?
Thanks
|
|
|
Re: Undo/Redo model property [message #1733003 is a reply to message #1732988] |
Mon, 23 May 2016 09:48 |
|
The approach was very similar with 0.1.0, only that the PropertySheetPage was not injected (for which the IPropertySheetFactory is now used).
You need to overwrite getAdapter() within your editor to return an UndoablePropertySheetPage. You will have to pass in a UndoRedoActionGroup to create it, which has to use the undo context of the FXDomain. It should be relatively straight-forward.
|
|
|
|
Powered by
FUDForum. Page generated in 0.03348 seconds