Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Problem Importing Other Languages
Problem Importing Other Languages [message #1033802] Thu, 04 April 2013 17:01 Go to next message
Carlo M-R is currently offline Carlo M-RFriend
Messages: 5
Registered: June 2011
Junior Member
Hi,

I had a problem with the GenerateDSL-Workflow especially with registering the genModel files in our development environment. I have found a sort of workaround but would like to know if there's a better way:

Our Xtext languages are built with maven and therefore are structured like maven projects (src/main/java etc. and target/classes as output dir). In the mwe2 file I wanted to register the genModel files as follows:

...
registerGeneratedEPackage = "com.myCompany.package.myDSL.MyDSLPackage"
registerGenModelFile = "platform:/resource/com.myCompany.package.myDSL/com/myCompany/package/MyDSL.genmodel"
...


With this config I always got the error that the path is unmapped.
I debugged the thing and found out that the org.eclipse.emf.mwe.utils.StandaloneSetup#setScanClassPath method should register the project (com.myCompany.package.myDslDSL) and allow the workflow to find the genmodel file.
But this does not work because of the way it handles project references:

...
else if (!scanFolder(f)) {
        // eclipse bin folder?
	File dotProject = new File(f.getParentFile(), ".project");
	if (dotProject.exists())
		registerProject(dotProject);
}
...


In our case the given classpath entry is not the eclipse bin folder but the target/classes folder and therefore it is not sufficient to just go one directory up. I hooked in a custom StandaloneSetup for testing were i simple did the following.

	
...
   File dotProject = new File(f.getParentFile().getParentFile(), ".project");
...


And this did the trick. The .project file is found and the project gets successfully registered and and the genmodel file is found.

Now i'm asking if this is a bug resp. missing feature in the StandaloneSetup or if there's a configuration possibility that I'm missing.


Thanks in advance for your help

Regards,
Carlo
Re: Problem Importing Other Languages [message #1033819 is a reply to message #1033802] Thu, 04 April 2013 17:24 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 13464
Registered: July 2009
Senior Member
Hi,

i guess in the case you should adopt platformUri="../../"


Need professional support for Xtext, Xpand, EMF?
Go to: https://www.itemis.com/en/xtext/
Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Problem Importing Other Languages [message #1034310 is a reply to message #1033819] Fri, 05 April 2013 09:18 Go to previous message
Carlo M-R is currently offline Carlo M-RFriend
Messages: 5
Registered: June 2011
Junior Member
Hi,

thanks for your hint, but the problem is that the projects that I want to import are not in the same root folder as the project I'm executing the workflow in.

Therefore I need to have the setScanClassPath method to register my project. But unfortunately this can't handle the target/classes folder.
Previous Topic:DSL Maturing, next steps
Next Topic:Getting all instances of particular grammar class
Goto Forum:
  


Current Time: Tue May 26 01:09:12 GMT 2020

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

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

Back to the top