Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » EMF commands during model import(Does EMF commands make sense while creating model partitions and attaching to main model)
EMF commands during model import [message #495688] Thu, 05 November 2009 18:44 Go to next message
Nirmal SasidharanFriend
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 #495707 is a reply to message #495688] Thu, 05 November 2009 19:42 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 33141
Registered: July 2009
Senior Member
Nirmal,

Comments below.

Nirmal Sasidharan wrote:
> 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.
Yes, only the attachment needs to be undoable, not the whole process of
constructing the object being attached.
> 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.
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.
>
>
> Would appreciate any help regarding this.
>
> Thanks and regards,
> Nirmal


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: EMF commands during model import [message #495722 is a reply to message #495707] Thu, 05 November 2009 20:19 Go to previous messageGo to next message
Nirmal SasidharanFriend
Messages: 120
Registered: July 2009
Location: Germany
Senior Member
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?

Also is it right that the command framework is built on top of ChangeRecorder?

Thanks and regards,
Nirmal


Re: EMF commands during model import [message #495744 is a reply to message #495722] Thu, 05 November 2009 21:20 Go to previous message
Ed Merks is currently offline Ed MerksFriend
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/
Previous Topic:Ecore model from a XML model - not a XML Schema!
Next Topic:Initialize by loading & copied packages
Goto Forum:
  


Current Time: Fri Apr 26 00:49:16 GMT 2024

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

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

Back to the top