Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 369192

Summary: Code generation error for node without domain element
Product: [Modeling] GMF-Tooling Reporter: Michael Golubev <borlander>
Component: Generation / TemplatesAssignee: Michael Golubev <borlander>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: borlander
Version: unspecified   
Target Milestone: 3.0M4   
Hardware: PC   
OS: Windows XP   
Whiteboard:

Description Michael Golubev CLA 2012-01-20 05:10:27 EST
From forum, original is located at http://www.eclipse.org/forums/index.php/t/277444/

<quote>
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 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»

</quote>
Comment 1 Michael Golubev CLA 2012-01-20 07:35:48 EST
pushed to 3.0 & 2.4M streams