Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using XCore Model for XText DSL
Using XCore Model for XText DSL [message #1061758] Mon, 03 June 2013 19:26 Go to next message
Johannes Wachter is currently offline Johannes WachterFriend
Messages: 4
Registered: June 2013
Junior Member
Hi,

I'm currently trying to use an XCore model as the base model for my XText DSL without having to generate an genmodel/ecore file for it.

My project setup looks like the following:

model-project/model/foo.xcore (containing one model class Foo { String name })
test.dsl
test.dsl.sdk
test.dsl.tests
test.dsl.ui


The model project exports all generated packages and the 'model' folder, the XText main project has a bundle dependency for it. In the MWE2 Workflow I define the inclusion of the XCore Model as follows:

    bean = StandaloneSetup {
    	scanClassPath = true
    	platformUri = "${runtimeProject}/.."
    	registerGeneratedEPackage = "foo.FooPackage"
    	registerGenModelFile = "platform:/resource/model-project/model/foo.xcore"
    	
    }


(I tried to registerEcoreFile & registerGenModelFile before which also didn't work and then went with the workaround proposed here https://bugs.eclipse.org/bugs/show_bug.cgi?id=379994)

In the .xtext file everything works out as expected, after adding the import I can define a rule to catch the one model class.

When I want to generate the DSL Infrastructure through the MWE2 file, I get the following exception:

Caused by: org.xml.sax.SAXParseExceptionpublicId: platform:/resource/model-project/model/foo.xcore; systemId: platform:/resource/model-project/model/foo.xcore; lineNumber: 1; columnNumber: 1; Content ist nicht zulässig in Prolog.



I tested this both with Juno SR2 and Kepler RC2 and it gave the same exception both times. Is that use case currently not possible or am I still doing something wrong?


Regards,
Johannes
Re: Using XCore Model for XText DSL [message #1061823 is a reply to message #1061758] Tue, 04 June 2013 09:07 Go to previous message
Jan Koehnlein is currently offline Jan KoehnleinFriend
Messages: 658
Registered: July 2009
Senior Member
The following resolved bug
https://bugs.eclipse.org/bugs/show_bug.cgi?id=379999
has a working example attached. Instead of loading the xcore file in the
standalone setup, you have to do this in the language section of the
Generator:
loadedResource =
"platform:/resource/${projectName}/src/org/xtext/example/mydsl/MyDsl.xcore"
Also make sure you are running a current RC of MWE2, Xtext and Xcore.


Am 03.06.13 23:03, schrieb Johannes Wachter:
> Hi,
>
> I'm currently trying to use an XCore model as the base model for my
> XText DSL without having to generate an genmodel/ecore file for it.
>
> My project setup looks like the following:
>
>
> model-project/model/foo.xcore (containing one model class Foo { String
> name })
> test.dsl
> test.dsl.sdk
> test.dsl.tests
> test.dsl.ui
>
>
> The model project exports all generated packages and the 'model' folder,
> the XText main project has a bundle dependency for it. In the MWE2
> Workflow I define the inclusion of the XCore Model as follows:
>
>
> bean = StandaloneSetup {
> scanClassPath = true
> platformUri = "${runtimeProject}/.."
> registerGeneratedEPackage = "foo.FooPackage"
> registerGenModelFile =
> "platform:/resource/model-project/model/foo.xcore"
>
> }
>
>
> (I tried to registerEcoreFile & registerGenModelFile before which also
> didn't work and then went with the workaround proposed here
> https://bugs.eclipse.org/bugs/show_bug.cgi?id=379994)
>
> In the .xtext file everything works out as expected, after adding the
> import I can define a rule to catch the one model class.
>
> When I want to generate the DSL Infrastructure through the MWE2 file, I
> get the following exception:
>
>
> Caused by: org.xml.sax.SAXParseExceptionpublicId:
> platform:/resource/model-project/model/foo.xcore; systemId:
> platform:/resource/model-project/model/foo.xcore; lineNumber: 1;
> columnNumber: 1; Content ist nicht zulässig in Prolog.
>
>
>
> I tested this both with Juno SR2 and Kepler RC2 and it gave the same
> exception both times. Is that use case currently not possible or am I
> still doing something wrong?
>
>
> Regards,
> Johannes


--
Need professional support for Eclipse Modeling?
Go visit: http://xtext.itemis.com
Previous Topic:CTRL+SPCACE for Cross Reference
Next Topic:Eclipse compiler, DSL, ant
Goto Forum:
  


Current Time: Mon Dec 22 11:33:33 GMT 2014

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

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