Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Serializing optional values
Serializing optional values [message #628954] Fri, 24 September 2010 21:04 Go to next message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
I get an error when trying to save a file that I am modifying using EMF calls from a separate editor (not an xtext text editor). (Actually it is worse than that since it removes the entire contents of the existing file)

The error says to consider implementing ITokenSerializer$IValueSerializer, but there does seem to be to override this in my RuntimeModule.

Here is an snippet of the grammar.

ThisOrThat returns ecore::EString:
'THIS' | 'THAT' ;

ExamplePolicy:
'POLICY' count=IntVal ThisOrThat ;

options?
Re: Serializing optional values [message #628988 is a reply to message #628954] Sat, 25 September 2010 15:09 Go to previous messageGo to next message
Sebastian Zarnekow is currently offline Sebastian ZarnekowFriend
Messages: 3118
Registered: July 2009
Senior Member
Hi Drew,

feel free to add a binding to your runtime module. Just define a method:

public Class<ITokenSerializer.IValueSerializer> bindValueSerializer() {
return MyImpl.class;
}

The framework will call your method reflectively and thereby register
the binding.

Regards,
Sebastian
--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


Am 24.09.10 23:04, schrieb drew frantz:
> I get an error when trying to save a file that I am modifying using EMF
> calls from a separate editor (not an xtext text editor). (Actually it is
> worse than that since it removes the entire contents of the existing file)
>
> The error says to consider implementing
> ITokenSerializer$IValueSerializer, but there does seem to be to override
> this in my RuntimeModule.
>
> Here is an snippet of the grammar.
>
> ThisOrThat returns ecore::EString: 'THIS' | 'THAT' ;
>
> ExamplePolicy:
> 'POLICY' count=IntVal ThisOrThat ;
>
> options?
>
Re: Serializing optional values [message #629522 is a reply to message #628954] Tue, 28 September 2010 14:54 Go to previous messageGo to next message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 760
Registered: July 2009
Location: Hamburg
Senior Member
In your grammar snippet, the call to ThisOrThat should be assigned to a
feature of Example Policy.

Am 24.09.10 23:04, schrieb drew frantz:
> I get an error when trying to save a file that I am modifying using EMF
> calls from a separate editor (not an xtext text editor). (Actually it is
> worse than that since it removes the entire contents of the existing file)
>
> The error says to consider implementing
> ITokenSerializer$IValueSerializer, but there does seem to be to override
> this in my RuntimeModule.
>
> Here is an snippet of the grammar.
>
> ThisOrThat returns ecore::EString: 'THIS' | 'THAT' ;
>
> ExamplePolicy:
> 'POLICY' count=IntVal ThisOrThat ;
>
> options?
>


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com


---
Get professional support from the Xtext committers at www.typefox.io
Re: Serializing optional values [message #629566 is a reply to message #628988] Tue, 28 September 2010 17:04 Go to previous message
drew frantz is currently offline drew frantzFriend
Messages: 340
Registered: July 2009
Senior Member
Thanks exactly what I needed.

"Sebastian Zarnekow" <Sebastian.Zarnekow@itemis.de> wrote in message
news:i7l35l$91a$1@news.eclipse.org...
> Hi Drew,
>
> feel free to add a binding to your runtime module. Just define a method:
>
> public Class<ITokenSerializer.IValueSerializer> bindValueSerializer() {
> return MyImpl.class;
> }
>
> The framework will call your method reflectively and thereby register the
> binding.
>
> Regards,
> Sebastian
> --
> Need professional support for Eclipse Modeling?
> Go visit: http://xtext.itemis.com
>
>
> Am 24.09.10 23:04, schrieb drew frantz:
>> I get an error when trying to save a file that I am modifying using EMF
>> calls from a separate editor (not an xtext text editor). (Actually it is
>> worse than that since it removes the entire contents of the existing
>> file)
>>
>> The error says to consider implementing
>> ITokenSerializer$IValueSerializer, but there does seem to be to override
>> this in my RuntimeModule.
>>
>> Here is an snippet of the grammar.
>>
>> ThisOrThat returns ecore::EString: 'THIS' | 'THAT' ;
>>
>> ExamplePolicy:
>> 'POLICY' count=IntVal ThisOrThat ;
>>
>> options?
>>
>
Previous Topic:Integration of the editor
Next Topic:Adding a prefix to Cross Reference field
Goto Forum:
  


Current Time: Wed Apr 24 16:07:11 GMT 2024

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

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

Back to the top