Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to share a CommandStack and/or EditDomain?
How to share a CommandStack and/or EditDomain? [message #520490] Fri, 12 March 2010 10:23 Go to next message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
Has anyone any experience of sharing a CommandStack and/or an EditDomain
between different GEF Editor Parts and an Eclipse View?

My situation is as follows:

1. I have a (EMF) domain model that is managed by the user in a
TreeViewer in an Eclipse View. Here, the user can add/delete domain
model objects.

2. The user can open one or more GEF Editor Parts which provide a
diagram editor for creating different diagrams based on the original
domain model. A graphical model is created for each GEF Editor and links
to the original domain model.

I need to synchronise (1) and (2) across a unified Command structure to
support a common Undo/Redo framework. For example:

The user may have two diagram editors open that share the same domain
model as seen in (1). He then deletes a model object in (1) and it
should be deleted from the graphical models in (2). There should be one
Undo/Redo operation available from the context of (1) and the editors in
(2) with one common Command.

I do not have any problems with notifications as (1) and (2) share a
common notifier via the EMF domain model. My problem is how to implement
the shared Undo/Redo.

Should I be using a shared CommandStack and use GEF Commands in (1)?

Thanks for any guidance.

Phil
Re: How to share a CommandStack and/or EditDomain? [message #520812 is a reply to message #520490] Mon, 15 March 2010 04:16 Go to previous message
h1055071 is currently offline h1055071
Messages: 335
Registered: July 2009
Senior Member
On 12/03/2010 15:23, Phillipus wrote:
> Has anyone any experience of sharing a CommandStack and/or an EditDomain
> between different GEF Editor Parts and an Eclipse View?
>
> My situation is as follows:
>
> 1. I have a (EMF) domain model that is managed by the user in a
> TreeViewer in an Eclipse View. Here, the user can add/delete domain
> model objects.
>
> 2. The user can open one or more GEF Editor Parts which provide a
> diagram editor for creating different diagrams based on the original
> domain model. A graphical model is created for each GEF Editor and links
> to the original domain model.
>
> I need to synchronise (1) and (2) across a unified Command structure to
> support a common Undo/Redo framework. For example:
>
> The user may have two diagram editors open that share the same domain
> model as seen in (1). He then deletes a model object in (1) and it
> should be deleted from the graphical models in (2). There should be one
> Undo/Redo operation available from the context of (1) and the editors in
> (2) with one common Command.
>
> I do not have any problems with notifications as (1) and (2) share a
> common notifier via the EMF domain model. My problem is how to implement
> the shared Undo/Redo.
>
> Should I be using a shared CommandStack and use GEF Commands in (1)?
>
> Thanks for any guidance.
>
> Phil
>
>

I shall reply to myself:

Declare a CommandStack that corresponds to the domain model. Use this
CommandStack in the TreeView (1) and in every GEF Editor that edits that
model (2). In the GEF Editor provide a DefaultEditDomain that returns
this one CommmandStack instead of the one created by the
DefaultEditDomain class.

PB
Previous Topic:[Zest] layout without keeping width / height ratio?
Next Topic:DirectEdit issue
Goto Forum:
  


Current Time: Mon Sep 01 14:36:36 EDT 2014

Powered by FUDForum. Page generated in 0.02450 seconds