Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » GMF (Graphical Modeling Framework) » Error during code generation
Error during code generation [message #1006024] Tue, 29 January 2013 10:23 Go to next message
Florian W. is currently offline Florian W.
Messages: 15
Registered: January 2013
Junior Member
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 #1006075 is a reply to message #1006024] Tue, 29 January 2013 13:05 Go to previous messageGo to next message
Aurelien Pupier is currently offline Aurelien Pupier
Messages: 556
Registered: July 2009
Location: Grenoble, FRANCE
Senior Member

Hi,

did you already take a look to this thread? http://www.eclipse.org/forums/index.php/m/688376/

Regards,


Aurélien Pupier - BonitaSoft S.A.
My blog
My company Eclipse-related blog
Re: Error during code generation [message #1006152 is a reply to message #1006075] Wed, 30 January 2013 04:14 Go to previous messageGo to next message
Florian W. is currently offline Florian W.
Messages: 15
Registered: January 2013
Junior Member
Hi,

thanks for the hint. Yes, I have already seen this thread. But the bug described there is declared as fixed and the problem was related to Eclipse Indigo.
Re: Error during code generation [message #1006229 is a reply to message #1006152] Wed, 30 January 2013 09:16 Go to previous messageGo to next message
Florian W. is currently offline Florian W.
Messages: 15
Registered: January 2013
Junior Member
Hi,

I have finally identified the problem: My Ecore-Model is generated from an XML Schema and thus contains a DocumentRoot class. The EAnnotians assigned to this class contain an attribute "name" which was empty. After storing a name in this field everything works!
Re: Error during code generation [message #1006234 is a reply to message #1006152] Wed, 30 January 2013 09:31 Go to previous messageGo to next message
Michael Golubev is currently offline Michael Golubev
Messages: 373
Registered: July 2009
Senior Member
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 #1006235 is a reply to message #1006234] Wed, 30 January 2013 09:37 Go to previous messageGo to next message
Michael Golubev is currently offline Michael Golubev
Messages: 373
Registered: July 2009
Senior Member
Hi Florian,

Thanks for explanation, this annotation problem indeed would make this error happen.
And that means that my fix idea above (changing "= null" -> ".oclIsUndefined") should work and allow to at least complete the code-generation by producing compilation error + comment in the generated code.

I will push the fix to git then Smile

Regards,
Michael

Re: Error during code generation [message #1006266 is a reply to message #1006235] Wed, 30 January 2013 10:55 Go to previous messageGo to next message
Florian W. is currently offline Florian W.
Messages: 15
Registered: January 2013
Junior Member
Hi Michael,

Thanks for your help! Unfortunately, the error also occurs with the new template:

Problems while generating code
Exception (Can't evaluate LET expression: actual variable type is not assignable to declared one:in aspects::xpt::editor::DiagramEditorUtil, line 14) while generating code
Can't evaluate LET expression: actual variable type is not assignable to declared one:in aspects::xpt::editor::DiagramEditorUtil, line 14


I have submitted the output of the modified template to bugzilla. I will not be able to post the model I am working on. But I could try and create a minimal not working example! Would this help you?

Regards,

Florian
Re: Error during code generation [message #1006276 is a reply to message #1006266] Wed, 30 January 2013 11:27 Go to previous messageGo to next message
Michael Golubev is currently offline Michael Golubev
Messages: 373
Registered: July 2009
Senior Member
Thanks, Florian, your output in Bugzilla should be enough.

Just to make it clear for me, is my understanding correct that you have solved the overall problem (by changing the annotation) and we are now talking about improvements for other possible users / cases?

Regards,
Michael



Re: Error during code generation [message #1006279 is a reply to message #1006276] Wed, 30 January 2013 11:42 Go to previous message
Florian W. is currently offline Florian W.
Messages: 15
Registered: January 2013
Junior Member
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]

Report message to a moderator

Previous Topic:How to implement drag and drop to customized figures?
Next Topic:Model to Code
Goto Forum:
  


Current Time: Tue Jul 29 00:36:41 EDT 2014

Powered by FUDForum. Page generated in 0.01846 seconds