Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » xtext from ecore bogus in mars + java 8(cannot create a project using New...Xtext project from existing ecore models)
xtext from ecore bogus in mars + java 8 [message #1709669] Wed, 30 September 2015 08:16 Go to next message
Vania Joloboff is currently offline Vania JoloboffFriend
Messages: 1
Registered: September 2015
Junior Member
Hi,
I am using Eclipse Mars running on Java 8 from Sun on Linux Mint.
I run Xtext 2.8.3
I have an ecore model in project saccades.traceModel/model as a file named simsocTraceModel.ecore. The java source code for the ecore model is generated
correctly into the saccades.traceModel/src/simsocTraceModel subdirectory
and all the java files are here including SimsocTraceModelPackage.java.
No problem with that. When I click on New..."Create Xtext project from existing ecore"
to create a new Xtext project named TraceMapping, it is bogus !!
It does create a project but with an error!!
Inside the Xtext grammar it generates a line
import "http#//saccades.traceModel/model/simsocTraceModel"
Note I have to use '#' instead of ':' because the forum thinks I have an http link in my message and prevents me from posting otherwise
and there is a red error message on this line telling this ecore does not exist !!
I found the good syntax is actually
import "platform:/resource/saccades.traceModel/model/simsocTraceModel.ecore"
Then the error sign disappears and I only get a warning sign that
it cannot find the Java package. I read on the forum similar problems and that I needed to add an Xtext nature to the ecore saccades.traceModel project. I did that. No change.
However, inside the Xtext grammar I can reference the model correctly
and I could define my grammar. Next, when I try to generate the parser for the grammar, it fails with error :

Couldn't find an interface for ... SimsocTraceModelPackage

The error is caused by the package reference in the GenerateTraceMapping.mwe2 file
Indeed in this file, there is a line

registerGeneratedEPackage = "a string to locate the ecore package"

and this is the cause of the failure.
I have tried several combinations for locating the package name. I have tried

"simsocTraceModel.SimsocTraceModelPackage"
"saccades.traceModel.src.simsocTraceModel.SimsocTraceModelPackage"
"saccades.traceModel/src/simsocTraceModel/SimsocTraceModelPackage"
"platform:/resource/saccades.traceModel/src/simsocTraceModel/SimsocTraceModelPackage"

None of them works.
I cannot find in xtext documentation the syntax to use.
Do you have any idea of which naming schema I have to use to import this damn package ?

Thanks in advance.


Re: xtext from ecore bogus in mars + java 8 [message #1709716 is a reply to message #1709669] Wed, 30 September 2015 14:14 Go to previous message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

does the Project with the ecore have xtext nature? if not: add it (right click -> configure)


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Previous Topic:Reference to current list
Next Topic:Indexing outside of the buider
Goto Forum:
  


Current Time: Thu Apr 25 10:31:18 GMT 2024

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

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

Back to the top