Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » GEF » How to Undo/Redo model changes?
How to Undo/Redo model changes? [message #214341] Sun, 16 April 2006 11:56 Go to next message
Jan van der Ven is currently offline Jan van der VenFriend
Messages: 18
Registered: July 2009
Junior Member
Dear all,


I have an Entity Relation Diagram editor based on the work by Phil Zoio.
I am currently working on a function that refreshes the diagram
contents to match the definition in the database (you have an older
diagram and want to continue working on that but meanwhile someone has
changed the table definition, more columns, other types.)
I created an action for that, that invokes a member of the diagram (as
part of the model group). The model can access the database definition,
and as such this is the logical place to see if the diagram's model
matches the database.
I call all my functions and the property aware stuff makes sure that the
diagram is updated.
However the modifications to the model are not part of the command
stack, as I have not gone through the action, request, command sequence.

That's because I thought these were only for user interactions and not
for programmatic model changes.

Can anyone point me in a direction for correct implementation? Where do
I create the request? What kind of request would that be? And what kind
of Policy would be required?

Thanks in advance.

Jan van der Ven
Re: How to Undo/Redo model changes? [message #214642 is a reply to message #214341] Wed, 19 April 2006 20:13 Go to previous message
Steven R. Shaw is currently offline Steven R. ShawFriend
Messages: 128
Registered: July 2009
Senior Member
You can define custom request types that represent model changes for your
domain. An example would be how the logic example increments / decrements
the LED model item. The IncrementDecrementAction creates a new request

....
request = new Request(INCREMENT_REQUEST);
....

Then the request is sent to the selected objects on the diagram surface.
The LEDEditPart has a custom EditPolicy LEDEditPolicy installed on it that
understands the INCREMENT_REQUEST. It then returns a custom command that
can handle undo/redo that will get executed on the command stack

@see LEDEditPolicy#IncrementDecrementCommand

Regards,

Steve.

"Jan H. van der Ven" <jhvdven@xs4all.nl> wrote in message
news:e1tbda$8q6$1@utils.eclipse.org...
> Dear all,
>
>
> I have an Entity Relation Diagram editor based on the work by Phil Zoio.
> I am currently working on a function that refreshes the diagram
> contents to match the definition in the database (you have an older
> diagram and want to continue working on that but meanwhile someone has
> changed the table definition, more columns, other types.)
> I created an action for that, that invokes a member of the diagram (as
> part of the model group). The model can access the database definition,
> and as such this is the logical place to see if the diagram's model
> matches the database.
> I call all my functions and the property aware stuff makes sure that the
> diagram is updated.
> However the modifications to the model are not part of the command
> stack, as I have not gone through the action, request, command sequence.
>
> That's because I thought these were only for user interactions and not
> for programmatic model changes.
>
> Can anyone point me in a direction for correct implementation? Where do
> I create the request? What kind of request would that be? And what kind
> of Policy would be required?
>
> Thanks in advance.
>
> Jan van der Ven
Previous Topic:Q re how to hide/collapse tree branch in GEF editor
Next Topic:temporary drawing??
Goto Forum:
  


Current Time: Wed Feb 05 15:01:39 GMT 2025

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

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

Back to the top