|
|
|
|
|
|
Re: Serialization of Xtext model [message #1796240 is a reply to message #1796232] |
Mon, 08 October 2018 16:25 |
Venkata Chittem Messages: 13 Registered: October 2018 |
Junior Member |
|
|
I have analyzed further! I found below function in myDSLSemanticSequencer.java which is raising the error i am getting.
Actually it could find the EFeature that it is looking for in the EObject, but in the .ecore this feature is set Transient so it is logging the error in createFeatureValueMissing() and is exiting all the way out of Resource.save() call.
After further searching with keywords "Xtext Serialize Transient", I found this thread https://www.eclipse.org/forums/index.php/t/1079269/, in which Christian Dietrich had answered (in 2009 :-) ) it that one can implement ITransientValueService to tell xtext that what to do with transient values.
Thanks a lot! I will try this tomorrow.
----------------------------
protected void sequence_myEClass(ISerializationContext context, myEClass semanticObject) {
if (errorAcceptor != null) {
if (transientValues.isValueTransient(semanticObject, myXmiPackage.eINSTANCE.getmyEClass_myERefContained()) == ValueTransient.YES)
errorAcceptor.accept(diagnosticProvider.createFeatureValueMissing(semanticObject, myXmiPackage.eINSTANCE.getmyEClass_myERefContained()));
}
SequenceFeeder feeder = createSequencerFeeder(context, semanticObject);
feeder.accept(grammarAccess.getmyEClassAccess().getmyERefContainedmyERefContainedParserRuleCall_1_0(), semanticObject.getmyERefContained());
feeder.finish();
}
SequencerDiagnosticProvider.class
@Override
public ISerializationDiagnostic createFeatureValueMissing(EObject semanticObject, EStructuralFeature feature) {
String msg = "A value for feature '" + feature.getName() + "' is missing but required.";
return new SerializationDiagnostic(FEATURE_VALUE_MISSING, semanticObject, grammarAccess.getGrammar(), msg);
}
|
|
|
Powered by
FUDForum. Page generated in 0.04078 seconds