Code generation error for node without domain element [message #780798] |
Thu, 19 January 2012 12:25 |
Eclipse User |
|
|
|
Hi,
I have a node mapping in my gmpmap model without a domain element. When I try to generate the diagram code, I get this error:
Exception (No Definition getLabelFeatureText(OclInvalid_Class) for GenChildNode could be found!) while generating code
org.eclipse.gmf.internal.xpand.model.EvaluationException: No Definition getLabelFeatureText(OclInvalid_Class) for GenChildNode could be found!
at org.eclipse.gmf.internal.xpand.XpandFacade.evaluate(XpandFacade.java:57)
at org.eclipse.gmf.internal.xpand.ast.ExpandStatement.evaluateInternal(ExpandStatement.java:139)
at org.eclipse.gmf.internal.xpand.ast.Statement.evaluate(Statement.java:29)
at...
I cannot make sense of it. I know it is caused by this particular node (if I remove it, everything works fine). Also, the validation does not complain about anything.
Any advice?
cheers,
Christian
|
|
|
|
Re: Code generation error for node without domain element [message #780809 is a reply to message #780806] |
Thu, 19 January 2012 13:10 |
Eclipse User |
|
|
|
I think the getText method for GenNodes causes the problem. It checks whether there are any labels and if there are none it uses the model elements metaclass to produce a label, but that is null. Strangely, in the same method for GenLink (also below) there is an explicit check whether the modelFacet is null (then an empty string is returned).
IS THIS A BUG IN THE TEMPLATE?
«DEFINE getText FOR gmfgen::GenNode-»
«IF labels->isEmpty()-»
«EXPAND getLabelFeatureText(modelFacet.metaClass)-»
«ELSE-»
«EXPAND getDiagramLabelText(labels->asSequence())-»
«ENDIF-»
«ENDDEFINE»
«DEFINE getText FOR gmfgen::GenLink-»
«IF labels->isEmpty()-»
«IF null <> modelFacet-»
«EXPAND getText(modelFacet)-»
«ELSE-»
«EXPAND returnEmptyString-»
«ENDIF-»
«ELSE-»
«EXPAND getDiagramLabelText(labels->asSequence())-»
«ENDIF-»
«ENDDEFINE»
|
|
|
Re: Code generation error for node without domain element [message #780810 is a reply to message #780809] |
Thu, 19 January 2012 13:26 |
Eclipse User |
|
|
|
This code fixes the problem:
«DEFINE getText FOR gmfgen::GenNode-»
«IF labels->isEmpty()-»
«IF null <> modelFacet-»
«EXPAND getLabelFeatureText(modelFacet.metaClass)-»
«ELSE-»
«EXPAND returnEmptyString-»
«ENDIF-»
«ELSE-»
«EXPAND getDiagramLabelText(labels->asSequence())-»
«ENDIF-»
«ENDDEFINE»
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03098 seconds