Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Custom Undo and Redo Behaviour for CreateConnectionFeature
Custom Undo and Redo Behaviour for CreateConnectionFeature [message #1753050] Wed, 01 February 2017 13:02 Go to next message
Thomas Thonhofer is currently offline Thomas ThonhoferFriend
Messages: 25
Registered: July 2013
Junior Member
Hi everyone

For my diagram editor I have some features which implement ICustomUndoRedoFeature for custom undo and redo behaviour. When the feature is executed I need to remember some used objects which are required in the case of an undo. Currently I do this by putting some properties into the context of the execute(IContext context) method and retrieve them from the context of preUndo(IContext context) method. My assumption was that the context passed to the execute is the same instance as the one passed to preUndo. For most cases it works like that and everything is fine.

For my CreateConnectionFeature however, the context passed to execute(IContext context) is a different instance then the context passed to preUndo(IContext context). This means that the properties I put in during execution are not available in undo.

What is the expected behaviour? Is my assumption that the context instance should always be the same for one execution wrong? If so, what would be the proper way of remembering some objects for a feature execution, which are later available for undo and redo? If not then this is either a bug or something else is going wrong in my implementation. Any ideas?

Thanks,
Thomas
Re: Custom Undo and Redo Behaviour for CreateConnectionFeature [message #1753055 is a reply to message #1753050] Wed, 01 February 2017 13:24 Go to previous messageGo to next message
Michael Wenz is currently offline Michael WenzFriend
Messages: 1883
Registered: July 2009
Location: Walldorf, Germany
Senior Member
Thomas,

this sounds pretty much like https://bugs.eclipse.org/bugs/show_bug.cgi?id=509764 .

Michael
Re: Custom Undo and Redo Behaviour for CreateConnectionFeature [message #1753065 is a reply to message #1753055] Wed, 01 February 2017 14:13 Go to previous message
Thomas Thonhofer is currently offline Thomas ThonhoferFriend
Messages: 25
Registered: July 2013
Junior Member
Dear Michael

Thank you for the reply. Yes it looks like this is the cause of my problem. I didn't find this bug when searching for a solution, sorry for that.

I will try to find a workaround until it is resolved.

Thanks,
Thomas
Previous Topic:Traverse diagram elements based on underlying EObject Properties
Next Topic:Custom Editor
Goto Forum:
  


Current Time: Sun Jan 21 02:59:53 GMT 2018

Powered by FUDForum. Page generated in 0.01545 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software