EMF commands during model import [message #495688] |
Thu, 05 November 2009 18:44 |
Nirmal Sasidharan Messages: 120 Registered: July 2009 Location: Germany |
Senior Member |
|
|
Hi,
I am working on an importer which creates some model elements and attaches itself to an existing EMF model. Does it make sense to
a) use EMF commands while creating these model elements (for example, the SetCommand to set some properties on these elements)
or
b) use commands only to attach these completed model elements (set with all required properties using setters) to the main model.
The intention of using commands here is not for undo-redo by the user, rather to create a transaction and undo the whole import incase something fails.
Would appreciate any help regarding this.
Thanks and regards,
Nirmal
|
|
|
|
|
Re: EMF commands during model import [message #495744 is a reply to message #495722] |
Thu, 05 November 2009 21:20 |
Ed Merks Messages: 33141 Registered: July 2009 |
Senior Member |
|
|
Nirmal,
Comments below.
Nirmal Sasidharan wrote:
> Thanks Ed for the quick reply.
>
> Ed Merks wrote on Thu, 05 November 2009 14:42
>> You might use a ChangeRecorder for that purpose. When you want to
>> cancel what's been done, you can convert it to a ChangeDescription
>> and invoke apply to undo all the changes.
>
>
> Is it right to say that a Command is useful when a Undo-Redo mechanism
> needs to be provided by the editor? For tracking changes to a model
> and doing a rollback a ChangeRecorder is more suitable?
Yes.
>
> Also is it right that the command framework is built on top of
> ChangeRecorder?
There is a ChangeCommand that uses a ChangeRecorder. Commands make
sense if you expect to have an stack that supports undo-redo. It's
easier to use a ChangeRecorder for doing just rollback.
>
> Thanks and regards,
> Nirmal
>
>
>
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
Powered by
FUDForum. Page generated in 0.03614 seconds