It seems that if my domain objects are not EMF based, then we don't get the undo/redo support (whether it's a move feature or add feature). After some digging, I noticed that Graphiti uses GFCommandStack class which seems to replace GEF's command stack with emf's command stack.
How do I get undo/redo support if my domain objects are not EMF based? Thank you for your suggestions!
Michael Wenz Messages: 1267 Registered: July 2009 Location: Walldorf, Germany
Senior Member
Yes, you are right. The advantage of doing it that way is that we can
completely handle undo/redo on EMF level by simply using the
RecordingCommand of EMF.
Also in a scenario with non-EMF domain objects, the part concerning the
graphical objects are handled automatically by Graphiti. Only the undo/redo
of the non-EMF domain object changes need to be implemented by you. In order
to do that you can use a GEF CommandStackEventListener that you register at
the CommandStack by
getEditDomain().getCommandStack().addCommandStackEventListen er(listener)
after the initiallization (e.g. by overriding setInput in DiagramEditor and
after calling super.setInput). There you can react to events POST_REDO and
POST_UNDO.
Hope that helps.
-Michael
"Shenxue Zhou" <shenxue.zhou@oracle.com> wrote in message
news:i5jsv9$74t$1@build.eclipse.org...
> It seems that if my domain objects are not EMF based, then we don't get
> the undo/redo support (whether it's a move feature or add feature). After
> some digging, I noticed that Graphiti uses GFCommandStack class which
> seems to replace GEF's command stack with emf's command stack.
> How do I get undo/redo support if my domain objects are not EMF based?
> Thank you for your suggestions!
>
> Shenxue