Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Graphiti » Undo/Redo support for non EMF based domain objects
Undo/Redo support for non EMF based domain objects [message #565897] Tue, 31 August 2010 17:42 Go to next message
Shenxue Zhou is currently offline Shenxue Zhou
Messages: 50
Registered: July 2009
Member
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
Re: Undo/Redo support for non EMF based domain objects [message #567884 is a reply to message #565897] Mon, 06 September 2010 08:32 Go to previous message
Michael Wenz is currently offline Michael Wenz
Messages: 1527
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
Previous Topic:SDK Feature
Next Topic:Hierarchical Layout and Active Status
Goto Forum:
  


Current Time: Wed Apr 23 02:47:01 EDT 2014

Powered by FUDForum. Page generated in 0.18448 seconds