Skip to main content



      Home
Home » Modeling » TMF (Xtext) » Persistence problem with optional assignment rules(Optional assigments are missing)
Persistence problem with optional assignment rules [message #698310] Tue, 19 July 2011 04:53 Go to next message
Eclipse UserFriend
Hi,

I populate a xtext model using the generated EMF factory, the resource implementation retrieved correctly via the extension registry.

Given an optional assignment rule 'members', these are not persisted. Is there a way to force optional items?

Structure:
	'struct' name=ID '{'
	members+=Member*
	'}';
Re: Persistence problem with optional assignment rules [message #698314 is a reply to message #698310] Tue, 19 July 2011 04:57 Go to previous messageGo to next message
Eclipse UserFriend
Hi, if the members are not optional why don't use

Structure:
	'struct' name=ID '{'
	members+=Member+
	'}';

Re: Persistence problem with optional assignment rules [message #698315 is a reply to message #698310] Tue, 19 July 2011 04:58 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

have you checked that the members are really contained in the structure? Which version of Xtext do you use? What does the code for the model population and serialisation look like?

Alex
Re: Persistence problem with optional assignment rules [message #698323 is a reply to message #698315] Tue, 19 July 2011 05:11 Go to previous messageGo to next message
Eclipse UserFriend
I use Xtext 2.0 and the structure members are populated. I could make it mandatory, but it feels bad. Optional means if it's there, it's there and serialized accordingly.

Member member = Factory.eINSTANCE.createMember();
structure.getMembers().add(member);


It's a containment feature and structure is added to the resource.

getResourceSet().getResources().get(0).save(null);


Resource is org.eclipse.xtext.resource.XtextResource as expected.

Thanks!

[Updated on: Tue, 19 July 2011 05:16] by Moderator

Re: Persistence problem with optional assignment rules [message #698327 is a reply to message #698323] Tue, 19 July 2011 05:21 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

do you use the experimental serialiser feature (not fully implemented yet) or the "old" ParseTreeConstructorFragment?
Re: Persistence problem with optional assignment rules [message #698331 is a reply to message #698327] Tue, 19 July 2011 05:28 Go to previous message
Eclipse UserFriend
Hi,

I guess the new one Rolling Eyes

// Serializer 2.0
fragment = serializer.SerializerFragment {}
Previous Topic:Package declaration help
Next Topic:Problem with unorder group
Goto Forum:
  


Current Time: Sat Jul 12 11:17:13 EDT 2025

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

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

Back to the top