Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » How to access EMF objects into a transaction
How to access EMF objects into a transaction [message #1062883] Tue, 11 June 2013 08:58 Go to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Hi all. Smile

Is there a way to execute some operations on EMF objects into a transaction?

I worry that the operations that I do on EMF objects (for scoping, labeling, and so on) are interleaved with those of the reconciler, so I obtain some org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException.

My fear is that the reconciler refreshes the model in another thread and so while I try to access it, the old model does not exist anymore (and so I have, for example, empty Elists).

How can I execute my operations on EMF model into an atomic transaction?


Thanks in advance,
Marco
Re: How to access EMF objects into a transaction [message #1062956 is a reply to message #1062883] Tue, 11 June 2013 14:18 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 658
Registered: July 2009
Senior Member
As this is the Xtext forum, I suppose your EMF model is based on Xtext.
As you are talking about the reconciler, I suppose your model is in an
editor.
=> you can use XtextDocument#modify() and encapsulate your changes in a
single IUnitOfWork

Am 11.06.13 10:58, schrieb Marco Naddeo:
> Hi all. :)
>
> Is there a way to execute some operations on EMF objects into a
> transaction?
>
> I worry that the operations that I do on EMF objects (for scoping,
> labeling, and so on) are interleaved with those of the reconciler, so I
> obtain some
> org.eclipse.emf.common.util.BasicEList$BasicIndexOutOfBoundsException.
>
> My fear is that the reconciler refreshes the model in another thread and
> so while I try to access it, the old model does not exist anymore (and
> so I have, for example, empty Elists).
>
> How can I execute my operations on EMF model into an atomic transaction?
>
>
> Thanks in advance,
> Marco


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Re: How to access EMF objects into a transaction [message #1062975 is a reply to message #1062956] Tue, 11 June 2013 15:01 Go to previous messageGo to next message
Marco Naddeo is currently offline Marco NaddeoFriend
Messages: 62
Registered: November 2012
Member
Ok, and how can I get the XtextDocument starting from an EObject of the model, or from the resource?
Re: How to access EMF objects into a transaction [message #1063129 is a reply to message #1062975] Wed, 12 June 2013 12:37 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 658
Registered: July 2009
Senior Member
How do you get the resource / EObject? My proposal was based on the fact
that you have the model loaded in an Xtext editor. Then it is
XtextEditor#getDocument().

Can you elaborate from where you want to modify the model?

Am 11.06.13 17:01, schrieb Marco Naddeo:
> Ok, and how can I get the XtextDocument starting from an EObject of the
> model, or from the resource?


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:Outline view flickers when updated
Next Topic:XtextRunner cannot be resolved to a variable
Goto Forum:
  


Current Time: Sat Dec 20 22:27:28 GMT 2014

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

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