Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » EMF » [Transaction] Editor to use single write transaction to modify EMF model until disposed(Can we have a single write transaction which shares life span with editor ?)
[Transaction] Editor to use single write transaction to modify EMF model until disposed [message #508790] Wed, 20 January 2010 10:48 Go to next message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 44
Registered: July 2009
Member
Hello Folks,

I have an EMF model tree which is built using 2 different meta-models (2 different ecores) which refer each other. We've built an editor which allows user to modify model contents picked up from both the models. the editor is up and working fine.

We have to now make a choice as to how do we discard the changes made on the 2 models using our editor... when user chooses not to save the editor.

If the editor has a single transaction in the background ... using which all modifications on the model are done (using TransactionalEditingDomain) ... then it'll be easier to either commit() those changes when user does a save ... or rollback() when the user closes the editor without saving.

Something like ... a write Transaction is initialized in the init() method of the editor ... and either rollback() or commit() is when editor is disposed.

I want to know if there is something fundamentally wrong with this approach.

+ Chetan Kumar
Re: [Transaction] Editor to use single write transaction to modify EMF model until disposed [message #508801 is a reply to message #508790] Wed, 20 January 2010 06:32 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 30691
Registered: July 2009
Senior Member
Chetan,

It seems to me you should do the rollback by undoing all commands on the
command stack until you get back to the last save point or the
beginning. After all, someone might have done editing, saved, done some
more editing, and then closed the editor.


Chetan Kumar wrote:
> Hello Folks,
>
> I have an EMF model tree which is built using 2 different meta-models
> (2 different ecores) which refer each other. We've built an editor
> which allows user to modify model contents picked up from both the
> models. the editor is up and working fine.
>
> We have to now make a choice as to how do we discard the changes made
> on the 2 models using our editor... when user chooses not to save the
> editor.
>
> If the editor has a single transaction in the background ... using
> which all modifications on the model are done (using
> TransactionalEditingDomain) ... then it'll be easier to either
> commit() those changes when user does a save ... or rollback() when
> the user closes the editor without saving.
>
> Something like ... a write Transaction is initialized in the init()
> method of the editor ... and either rollback() or commit() is when
> editor is disposed.
>
> I want to know if there is something fundamentally wrong with this
> approach.
> + Chetan Kumar
Re: [Transaction] Editor to use single write transaction to modify EMF model until disposed [message #509073 is a reply to message #508801] Thu, 21 January 2010 10:46 Go to previous message
Chetan Kumar is currently offline Chetan KumarFriend
Messages: 44
Registered: July 2009
Member
thats a better option. Thanks Ed!



Previous Topic:Runtime meta data with generic concept
Next Topic:Make generated EMF classes implement Serializable
Goto Forum:
  


Current Time: Wed Dec 11 10:51:07 GMT 2019

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

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

Back to the top