Skip to main content


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 15:23 Go to next message
h1055071 is currently offline h1055071Friend
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 08:16 Go to previous message
h1055071 is currently offline h1055071Friend
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: Fri Apr 26 14:11:17 GMT 2024

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

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

Back to the top