|
Re: How to Undo/Redo model changes? [message #214642 is a reply to message #214341] |
Wed, 19 April 2006 20:13 |
Steven R. Shaw 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
|
|
|
Powered by
FUDForum. Page generated in 0.02988 seconds