Error during code generation [message #1006024] |
Tue, 29 January 2013 10:23  |
Eclipse User |
|
|
|
Hi,
I am currently trying to build my own graphical editor with GMF and Eclipse Juno (latest updates installed). I already have a working Ecore model and I have managed to create a graphical definition, a tooling definition, a mapping and a generator model. But at the end of code generation process I always get the message:
Problems while generating code
Exception (Can't evaluate LET expression: actual variable type is not assignable to declared one:in xpt::editor::DiagramEditorUtil, line 257) while generating code
Can't evaluate LET expression: actual variable type is not assignable to declared one:in xpt::editor::DiagramEditorUtil, line 257
I have altered the configuration already in many ways (different diagram root element) but the error message is always the same.
Does anybody have an idea what is going wrong?
|
|
|
|
|
|
Re: Error during code generation [message #1006234 is a reply to message #1006152] |
Wed, 30 January 2013 09:31   |
Eclipse User |
|
|
|
Hi, Florian
I have submitted https://bugs.eclipse.org/bugs/show_bug.cgi?id=399495
I was unable to reproduce the issue with samples I have, but I have an idea of whats going wrong.
Can you please attach to bugzilla the input artifacts you have to check the fix?
If its not possible, I would ask you to
- enable dynamic templates in the GenEditorGenerator
- set the value of GenEditorGenerator#dynamicTemplatesDirectory to "/<your plugin with gmf artifacts>/templates/"
- create the folders <your plugin with gmf artifacts>/templates/aspects/xpt/editor/
- create the file DiagramEditorUtil.xpt here with text as follows:
«IMPORT 'http://www.eclipse.org/gmf/2009/GenModel'»
«EXTENSION xpt::editor::GenDiagram»
«AROUND createDocumentRootMethod FOR gmfgen::GenDiagram»
«EXPAND xpt::Common::generatedMemberComment»
private static «EXPAND MetaModel::QualifiedClassName FOR getDocumentRoot(self)» createDocumentRoot(«EXPAND MetaModel::QualifiedClassName FOR domainDiagramElement» model) {
// [1] «getDocumentRoot(self)»
// [2] «getDocumentRootSetFeature(self)»
«IF domainDiagramElement = getDocumentRoot(self)»
return model;
«ELSE»
«EXPAND MetaModel::NewInstance('docRoot') FOR getDocumentRoot(self)»
«LET getDocumentRootSetFeature(self) AS f»
«IF f.oclIsUndefined()-»
docRoot.set«domainDiagramElement.ecoreClass.name»(model); // FIXME name of the set method is pure guess«ELSE-»
«EXPAND MetaModel::modifyFeature('docRoot', getDocumentRoot(self), 'model') FOR f»«ENDIF»
«ENDLET-»
return docRoot;
«ENDIF»
}
«ENDAROUND»
- run the generation
I guess that it may solve the problem itself (let me know, I will push the fix to git then)
If the error still here, remove from this AROUND everything except the first 2 lines "// [1]..." and "// [2]...", run the generation and attach to Bugzilla the (possibly not compiliable) generated method body.
Regards,
Michael
|
|
|
|
|
|
Re: Error during code generation [message #1006279 is a reply to message #1006276] |
Wed, 30 January 2013 11:42  |
Eclipse User |
|
|
|
Hi Michael,
changing the attribute only solves the code generation problem in GMF. However, the generated EMF editor throws an error when opening documents. A workaround may be to generate the editor code first and then modify the attribute value. Perhaps, the empty name attribute in the document root is an EMF problem? I have found no way to influence the value of this attribute through ecore annotations in the XML schema.
I have prepared a sample XML schema. Maybe this helps in determining the actual problem!
Regards,
Florian
[Updated on: Thu, 31 January 2013 03:51] by Moderator
|
|
|
Powered by
FUDForum. Page generated in 0.07299 seconds