[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [ve-dev] Questions about decoder
|
Hi Gili,
Thanks for your reply.
Few followup questions:
>>> Gili >>>
What is the significance of restore() method of IExpressionDecoderHelper?
What should this method do?
> See AbstractExpressionDecoder.decode(), If there is no cache, a regular
decode will be driven.
> This implies that the decoder will create/update EMF model elements, as
well as all the BDM meta information.
> If a cache exists, this implies that the EMF model is already online;
decoders will not change it.
> In this case a restore() is called. A decoder is responsible to *restore*
its meta information
> to the existing model (e.g., use the IJavaObject already in the model,
attache adapters etc.)
>>>>>>>>>>>>
So the restore() is not supposed to touch the EMF model.
Then for a parent child relation, e.g. panel.add(getULCButton()), should the
restore() method do the following:
// get the child bean part from the arguments in the above expression
fChildBeanPart =
decodeArguments((MethodInvocation)getExpression(decodingContent), false);
if (fChildBeanPart == null) {
throw new CodeGenException("No Child Bean Part");
}
fChildBeanPart.addBackRef(fbeanPart,
(EReference)fFmapper.getFeature(null));
fbeanPart.addChild(fChildBeanPart);
if(!getExpressionReferences().contains(fChildBeanPart.getEObject()))
getExpressionReferences().add(fChildBeanPart.getEObject());
return true;
This is what you do in the AbstractContainerAddDecoderHelper.restore()?
Thanks and regards,
Janak