Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » M2T (model-to-text transformation) » [xPand] how to create directory hierarchy
[xPand] how to create directory hierarchy [message #517909] Tue, 02 March 2010 14:01 Go to next message
Urtzi Odriozola is currently offline Urtzi OdriozolaFriend
Messages: 27
Registered: March 2010
Junior Member
hello,

I'm working with xtext/xpand and I've made a DSL grammar in xtext where specifies a directory hierarchy. Now I wanna create this hierarchy to them generate the corresponding java code in each package.

Explaining in other words, I wanna generate code in a dinamic directory hierarchy like this:

«DEFINE main FOR TestProject»
«EXPAND TestSuite FOREACH testsuites»
«ENDDEFINE»

«DEFINE TestSuite FOR TestSuite»
«FILE TestProject.name+"/"+name+"/"+testcase.name+".java"-»
// Code for the java class
«ENDDEFINE»

The issue is that I get this error:

3031 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Failed to create parent directories of file myFolder\src-gen\myDsl::TestProject\Fact_Extraction\Fact_Ext raction_TestCase.java

Has someone any idea?

Thanks for all.
Re: [xPand] how to create directory hierarchy [message #518163 is a reply to message #517909] Wed, 03 March 2010 10:29 Go to previous messageGo to next message
Darius Jockel is currently offline Darius JockelFriend
Messages: 63
Registered: July 2009
Member
Urtzi Odriozola wrote on Tue, 02 March 2010 09:01

The issue is that I get this error:

3031 [main] ERROR eclipse.emf.mwe.core.WorkflowRunner - Failed to create parent directories of file myFolder\src-gen\myDsl::TestProject\Fact_Extraction\Fact_Ext raction_TestCase.java


Hello Urtzi Odriozola.

Maybe it is because you can not create a directory '\myDsl::TestProject'?
You have to fix the Testsuite Define like this:
«DEFINE TestSuite FOR TestSuite»
	«FILE TestProject.name+"/"+name+"/"+testcase.name+".java"-»
// Code for the java class
«ENDDEFINE»

«DEFINE TestSuite FOR TestSuite»
	«FILE getTestProjectName()+"/"+name+"/"+testcase.name+".java"-»
// Code for the java class
«ENDDEFINE»

whereas getTestProjectName() naivgates to the TestProject and get the name. Maybe: ((TestProject)this.eContainer).name

Regards
Darius
Re: [xPand] how to create directory hierarchy [message #518488 is a reply to message #518163] Thu, 04 March 2010 09:45 Go to previous message
Urtzi Odriozola is currently offline Urtzi OdriozolaFriend
Messages: 27
Registered: March 2010
Junior Member
Darius Jockel wrote on Wed, 03 March 2010 05:29

Maybe it is because you can not create a directory '\myDsl::TestProject'?


yes, of course. I knew that. Maybe I didn´t express what I wanted. The issue was if I was able to call supertype parameters from subtype <<DEFINE>> structure.

But I found a solution, that is just something like this:

<<DEFINE main FOR superType>>
<<EXPAND class(superType.parameter) FOREACH subType>>
<<ENDDEFINE>>

<<DEFINE class(String superTypeName) FOR subType>>
<<FILE superTypeName+"/"+supType.name+".java">>
// Java code
<<ENDFILE>>
<<ENDDEFINE>>

So, thank you for the replay!!!

Regards,

[Updated on: Thu, 04 March 2010 09:45]

Report message to a moderator

Previous Topic:uml Behavior diagrams
Next Topic:A few questions about JET2...
Goto Forum:
  


Current Time: Fri Mar 29 01:44:03 GMT 2024

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

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

Back to the top