Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369192 - Code generation error for node without domain element
Summary: Code generation error for node without domain element
Status: RESOLVED FIXED
Alias: None
Product: GMF-Tooling
Classification: Modeling
Component: Generation / Templates (show other bugs)
Version: unspecified   Edit
Hardware: PC Windows XP
: P3 normal (vote)
Target Milestone: 3.0M4   Edit
Assignee: Michael Golubev CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2012-01-20 05:10 EST by Michael Golubev CLA
Modified: 2012-01-20 07:35 EST (History)
1 user (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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