Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » [Xtext] getCommentsForEObject fails
[Xtext] getCommentsForEObject fails [message #686152] Tue, 21 June 2011 16:43 Go to next message
Kelly Garces is currently offline Kelly GarcesFriend
Messages: 39
Registered: July 2009
Member
Hi,

I have a scenario quite similar to the one described here:
http://www.eclipse.org/forums/index.php/m/557250/?srch=Could+not+serialize+cross+reference+from#msg_557250

This is, I am populating a new resource whose objects point to a
resource already existing (kind-of library). I solved the
cross-references serialization problem by applying Christian Dietrich's
advice.

Now I face another problem the
HiddenTokenSequencer.getCommentsForEObject fails. The problem is that
the eAdapters list of my new resource is null. Do you know so far the
reason behind it?

Thank you,
--
Kelly Garcés
INRIA Sophia Antipolis - Méditerranée
Post-doct fellow with AOSTE team
http://www-sop.inria.fr/members/Kelly.Garces_Pernett/
Re: [Xtext] getCommentsForEObject fails [message #688219 is a reply to message #686152] Fri, 24 June 2011 07:38 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 6/21/11 6:43 PM, schrieb Kelly Garces:
> Now I face another problem the
> HiddenTokenSequencer.getCommentsForEObject fails. The problem is that
> the eAdapters list of my new resource is null. Do you know so far the
> reason behind it?

Is your Resource not extending Notifier?
Usually it can't be null this there's a guard in Notifier.eAdapters().

Do you have a stack trace and additional information about what kind of
Resource you have?

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: [Xtext] getCommentsForEObject fails [message #688365 is a reply to message #688219] Fri, 24 June 2011 14:08 Go to previous messageGo to next message
Kelly Garces is currently offline Kelly GarcesFriend
Messages: 39
Registered: July 2009
Member
Hi Sven
> > Is your Resource not extending Notifier?
> Usually it can't be null this there's a guard in Notifier.eAdapters().


I have an XtextResource. Let me give you more details...
So far I have to libraries A and B, B points to some elements of A.
A is the kernel library.
When I try to serialize a new resource (which I have populate using Java
code) that points to elements of B, it works!
But when my resource points to A, the serialization fails :(

Hereby the error I have (Note that I have defined ResourceDescriptions
as indicated in Xtext help):

org.eclipse.xtext.parsetree.reconstr.XtextSerializationException: Could
not serialize cross reference from
ClockConstraintSystem'system'.subBlock[0]->Block'main'.relations[0]->Relation'rel_0'.bindings[0]->Binding.abstract
to
Library'kernelLibrary'.relationLibraries[0]->RelationLibrary'kernelRelations'.relationDeclarations[1]->Coincidence'Coincides'.rightEntity->AbstractEntity'Clock1'
at
org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor$AssignmentToken.serializeInternal(AbstractParseTreeConstructor.java:255)
at
org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor$AbstractToken.serialize(AbstractParseTreeConstructor.java:156)

Thank you for your help!

--
Kelly Garcés
INRIA Sophia Antipolis - Méditerranée
Post-doct fellow with AOSTE team
http://www-sop.inria.fr/members/Kelly.Garces_Pernett/
Re: [Xtext] getCommentsForEObject fails [message #689215 is a reply to message #688365] Mon, 27 June 2011 06:50 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
How do you load resource A?

Am 6/24/11 4:08 PM, schrieb Kelly Garces:
>
> Hi Sven
>> > Is your Resource not extending Notifier?
>> Usually it can't be null this there's a guard in Notifier.eAdapters().
>
>
> I have an XtextResource. Let me give you more details...
> So far I have to libraries A and B, B points to some elements of A.
> A is the kernel library.
> When I try to serialize a new resource (which I have populate using Java
> code) that points to elements of B, it works!
> But when my resource points to A, the serialization fails :(
>
> Hereby the error I have (Note that I have defined ResourceDescriptions
> as indicated in Xtext help):
>
> org.eclipse.xtext.parsetree.reconstr.XtextSerializationException: Could
> not serialize cross reference from
> ClockConstraintSystem'system'.subBlock[0]->Block'main'.relations[0]->Relation'rel_0'.bindings[0]->Binding.abstract
> to
> Library'kernelLibrary'.relationLibraries[0]->RelationLibrary'kernelRelations'.relationDeclarations[1]->Coincidence'Coincides'.rightEntity->AbstractEntity'Clock1'
>
> at
> org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor$AssignmentToken.serializeInternal(AbstractParseTreeConstructor.java:255)
>
> at
> org.eclipse.xtext.parsetree.reconstr.impl.AbstractParseTreeConstructor$AbstractToken.serialize(AbstractParseTreeConstructor.java:156)
>
>
> Thank you for your help!
>


--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: [Xtext] getCommentsForEObject fails [message #689302 is a reply to message #689215] Mon, 27 June 2011 11:24 Go to previous messageGo to next message
Kelly Garces is currently offline Kelly GarcesFriend
Messages: 39
Registered: July 2009
Member
Sven,


> How do you load resource A?

Hereby the code I use:

CCSLLibraryStandaloneSetup.doSetup(); // this method executes
createInjectorAndDoEMFRegistration needed for my libraries
ExtendedCCSLStandaloneSetup.doSetup(); // this method executes
createInjectorAndDoEMFRegistration needed for my models pointed to
libraries

ExtendedCCSLStandaloneSetup ess = new ExtendedCCSLStandaloneSetup();
xTextInjector = ess.createInjector();
xTextResourceSet = xTextInjector.getInstance(XtextResourceSet.class);
xTextResourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL,
Boolean.TRUE);

Resource r = xTextResourceSet.createResource(uri);
r.getContents().add(cs); // cs is the root element of my model

Cheers,

--
Kelly Garcés
INRIA Sophia Antipolis - Méditerranée
Post-doct fellow with AOSTE team
http://www-sop.inria.fr/members/Kelly.Garces_Pernett/
Re: [Xtext] getCommentsForEObject fails [message #690398 is a reply to message #689302] Wed, 29 June 2011 13:14 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Am 6/27/11 1:24 PM, schrieb Kelly Garces:
> Sven,
>
>
>> How do you load resource A?
>
> Hereby the code I use:
>
> CCSLLibraryStandaloneSetup.doSetup(); // this method executes
> createInjectorAndDoEMFRegistration needed for my libraries
> ExtendedCCSLStandaloneSetup.doSetup(); // this method executes
> createInjectorAndDoEMFRegistration needed for my models pointed to
> libraries
>
> ExtendedCCSLStandaloneSetup ess = new ExtendedCCSLStandaloneSetup();
> xTextInjector = ess.createInjector();
> xTextResourceSet =
> xTextInjector.getInstance(XtextResourceSet.class);
> xTextResourceSet.addLoadOption(XtextResource.OPTION_RESOLVE_ALL,
> Boolean.TRUE);
>
> Resource r = xTextResourceSet.createResource(uri);
> r.getContents().add(cs); // cs is the root element of my model
>
> Cheers,
>

The referenced EObjects need to reside in a resource.
And you should use that resourceset to create and populate your resource.

Sven

--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
Re: [Xtext] getCommentsForEObject fails [message #691318 is a reply to message #690398] Fri, 01 July 2011 07:51 Go to previous message
Kelly Garces is currently offline Kelly GarcesFriend
Messages: 39
Registered: July 2009
Member
>>>
> The referenced EObjects need to reside in a resource.
> And you should use that resourceset to create and populate your resource.
>
Thank you Sven, serialization works now!

--
Kelly Garcés
INRIA Sophia Antipolis - Méditerranée
Post-doct fellow with AOSTE team
http://www-sop.inria.fr/members/Kelly.Garces_Pernett/
Previous Topic:UNTIL token question
Next Topic:Eclipse editor gets slow as hell...
Goto Forum:
  


Current Time: Thu Apr 25 10:58:47 GMT 2024

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

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

Back to the top