Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Ecore Tools » How to serialize default values with domain specific editor
How to serialize default values with domain specific editor [message #1696133] Fri, 22 May 2015 09:34 Go to next message
Thanh Liem Phan is currently offline Thanh Liem PhanFriend
Messages: 28
Registered: January 2015
Junior Member
Hi,

I have created a metamodel in ecore format and then generated its editor.
Everything is fine but all default values are not saved in the output file.
For example :
- boolean attribute: isOptimization = false => it will not be saved
- double attribute: min = 1 => OK but min = 0 => it will not be saved.

In this case, it's important to save all the default values because the output file will be read by the third party application in C++, for example.

There's some posts discuss a solution of overriding the shouldSaveFeature in XMLSaveImpl:
https://www.eclipse.org/forums/index.php/t/156246/
but I couldn't figure out how to change the default behavior.

Do you have any idea?
Thanks for your help.
Re: How to serialize default values with domain specific editor [message #1701735 is a reply to message #1696133] Wed, 15 July 2015 09:51 Go to previous message
Cedric Brun is currently offline Cedric BrunFriend
Messages: 427
Registered: July 2009
Senior Member
There is an option which can be passed during the Resource.save() : XMLResource.OPTION_KEEP_DEFAULT_CONTENT

http://download.eclipse.org/modeling/emf/emf/javadoc/2.4.2/org/eclipse/emf/ecore/xmi/XMLResource.html#OPTION_KEEP_DEFAULT_CONTENT


http://cedric.brun.io news and articles on eclipse and eclipse modeling.
Previous Topic:Extending EcoreTools with new EAnnotation-based layers
Next Topic:Ecore diagram editor does not load when I click the (aird) file
Goto Forum:
  


Current Time: Fri Jan 19 23:32:59 GMT 2018

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

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