Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo] Filename based on result of EOperation([Acceleo] Filename based on result of EOperation)
[Acceleo] Filename based on result of EOperation [message #1781429] Wed, 07 February 2018 09:44 Go to next message
Bruce Trask is currently offline Bruce TraskFriend
Messages: 56
Registered: July 2009
Member
I would like to generate a file whose name depends on the result of a called EOperation which returns a string.

So instead of doing this:

[file ('APPLICATION.'.concat(application.name), false, 'UTF-8')]
contents
[/file]

which works fine.

I would like to do this where getPropertyFileName is an EOperation I have added to the application model element.

[file ('APPLICATION.'.concat(application.getPropertyFileName()), false, 'UTF-8')]
contents
[/file]

But I get an error from Acceleo:
org.eclipse.acceleo.engine.AcceleoEvaluationException: Couldn't evaluate URL of the file at line 310 in Module generate for block file('APPLICATION.'.concat(application.getPropertyFileName()), false, 'UTF-8'). Last recorded value of self was mymodel.impl.ApplicationImpl@3c77d488 (name: MyApp).

Not sure what the error message is doing to help me here?

Does the Acceleo file creation support the calling of an EOperation? It shows up as valid when I do ctrl-space.

Regards,
Bruce




[Updated on: Wed, 07 February 2018 09:45]

Report message to a moderator

Re: [Acceleo] Filename based on result of EOperation [message #1782436 is a reply to message #1781429] Fri, 23 February 2018 13:42 Go to previous message
Laurent Goubet is currently offline Laurent GoubetFriend
Messages: 1857
Registered: July 2009
Senior Member
Hello Bruce,

What you're pasting here looks alright, this should have worked, as long as "getPropertyFileName" exists on "application" and can be called. You can try to check what would happen with the following:

[file ('log', false, 'UTF-8')]
[application.getPropertyFileName()/]
[/file]
[file ('APPLICATION.'.concat(application.getPropertyFileName()), false, 'UTF-8')]
...


This will force Acceleo into trying to generate the result of calling "getPropertyFileName()" into a file named "log" at your generation root and help us debug the issue.

Laurent Goubet
Obeo
Previous Topic:Acceleo and Xtext metamodel
Next Topic:[MTL] Reading Opaque Expressions
Goto Forum:
  


Current Time: Sat May 26 04:36:10 GMT 2018

Powered by FUDForum. Page generated in 0.01527 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top