Skip to main content



      Home
Home » Modeling » M2T (model-to-text transformation) » [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo?([Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo?)
[Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #754037] Mon, 31 October 2011 10:57 Go to next message
Eclipse UserFriend
Hi everyone,

I am thinking about using Acceleo and I want to use Xtext2 to create a concrete model-file. This files look like this "myModel.myLanguage". Is there a possiblity to use such files in acceleo to generate code? Or some kind of workaround? (At least i do not know that I can convert myModel.myLanguage to an .ecore file automatically).

Thanks in advance for any answer Smile

Greets
Jonnyboy

[Updated on: Mon, 31 October 2011 12:27] by Moderator

Re: Can I use files for concrete models created with xtext2? [message #754058 is a reply to message #754037] Mon, 31 October 2011 11:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

no you should be able to use the .mydsl files directly without doing anything extra.

~Christian
Re: Can I use files for concrete models created with xtext2? [message #754071 is a reply to message #754058] Mon, 31 October 2011 12:19 Go to previous messageGo to next message
Eclipse UserFriend
Hello Christian, thanks for your answer.

How should that be possible (I am sure you know how but I want to show how I think right now)? I mean the myDsl-file does not contain the informations of the underlying grammar. How can he convert a specific dsl with specific key words to a EMF model?

You say that I only need to refer the mydsl-file in acceleo. If I run the mtl.file and say there that my mydsl file should be the model file (logically) errors occur. What do I do wrong.

THX in advance
Jonnyboy
Re: Can I use files for concrete models created with xtext2? [message #754075 is a reply to message #754071] Mon, 31 October 2011 12:28 Go to previous messageGo to next message
Eclipse UserFriend
Hi, are you doing this in the runtime eclipse or in the host eclipse? btw xtext generatores and ecore and registers a resourcefactory. this is why it is working.

[Updated on: Mon, 31 October 2011 12:30] by Moderator

Re: Can I use files for concrete models created with xtext2? [message #754083 is a reply to message #754075] Mon, 31 October 2011 12:59 Go to previous messageGo to next message
Eclipse UserFriend
On 31/10/2011 16:29, Christian Dietrich wrote:
> Hi, are you doing this in the runtime eclipse or in the host eclipse?
Acceleo is usually standalone, so I expect you will fall foul of Xtext's
non-standard package registration.

You must add MyDslStandaloneSetup.doSetUp() where the Acceleo generated
MyDsl.java tells you to register packages that it hasn't registered for
you automatically.

Regards

Ed Willink
Re: Can I use files for concrete models created with xtext2? [message #754396 is a reply to message #754083] Wed, 02 November 2011 08:32 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks for your answers.

(Edward Willink)
>You must add MyDslStandaloneSetup.doSetUp() where the Acceleo generated
MyDsl.java tells you to register packages that it hasn't registered for
you automatically.

==> I did that in a project. I created the project in a new Workbench which has the depending Xtext plug-in (which defined the dsl). Is this so ok?

I wrote a little mtl-file:

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/emf/2002/Ecore')]
[template public generateElement(aEClass : EClass)]
[comment @main /]
[file(name.concat('.java'), false)]
test
[/file]
[/template]

==> but if I start that and refer to a "mydsl" file nothing happens (no errors occur - just nothing happens). Why? E.g. I have the following rule in the xtext file:
Entity:
"entity" name=ID ("extends" superType=[Entity])? "{"
features+=Feature*
"}";
If I want to create a simple Java file for every Entity -> [template public generateElement(aEClass : EClass)] -> do I have to change this to something like entity: Entity?

Thanks for any answer
Jonnyboy
Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #754401 is a reply to message #754037] Wed, 02 November 2011 08:46 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

Thanks for your answers.

(Edward Willink)
>You must add MyDslStandaloneSetup.doSetUp() where the Acceleo generated
MyDsl.java tells you to register packages that it hasn't registered for
you automatically.

==> I did that in a project. I created the project in a new Workbench which has the depending Xtext plug-in (which defined the dsl). Is this so ok?

I wrote a little mtl-file:

[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/emf/2002/Ecore')]
[template public generateElement(aEClass : EClass)]
[comment @main /]
[file(name.concat('.java'), false)]
test
[/file]
[/template]

==> but if I start that and refer to a "mydsl" file nothing happens (no errors occur - just nothing happens). Why? E.g. I have the following rule in the xtext file:
Entity:
"entity" name=ID ("extends" superType=[Entity])? "{"
features+=Feature*
"}";
If I want to create a simple Java file for every Entity -> [template public generateElement(aEClass : EClass)] -> do I have to change this to something like entity: Entity?

Thanks for any answer
Jonnyboy
Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #754402 is a reply to message #754401] Wed, 02 November 2011 08:53 Go to previous messageGo to next message
Eclipse UserFriend
Hi,

yes you of course have to chnage this.
you have to use the namespace of your dsl too

[module generate('http://www.xtext.org/example/mydsl/MyDsl)]
[template public generateElement(entity: Entity)]

btw the acceleo wizard should help you with that.

[Updated on: Wed, 02 November 2011 08:53] by Moderator

Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #754408 is a reply to message #754402] Wed, 02 November 2011 09:08 Go to previous messageGo to next message
Eclipse UserFriend
Thank you,

It finally works Smile

The thread can be closed ^^
Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #834895 is a reply to message #754402] Mon, 02 April 2012 10:34 Go to previous messageGo to next message
Eclipse UserFriend
Hello,

I also want to use acceleo to manipulate models produced from a Xtext concrete syntax. I've seen the example for android and this thread but in each case the metamodel is generated by Xtext. In my case the metamodel is classically created in ecore BUT a concrete syntax has been created for it.

I added the nsURI of my metamodel but it does not depend on the Xtext project. How can I tell acceleo to use the xtext resource stuff to load the file ?

thanks,

julien
Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #835060 is a reply to message #834895] Mon, 02 April 2012 14:41 Go to previous messageGo to next message
Eclipse UserFriend
Hi Julien

Put your XXXStandaloneSetup.doSetup() where the Acceleo comments tell
you to register your EPackages. Plenty of examples in
org.eclipse.ocl.examples.build.

Regards

Ed Willink


On 02/04/2012 15:34, Julien DeAntoni wrote:
> Hello,
>
> I also want to use acceleo to manipulate models produced from a Xtext
> concrete syntax. I've seen the example for android and this thread but
> in each case the metamodel is generated by Xtext. In my case the
> metamodel is classically created in ecore BUT a concrete syntax has
> been created for it.
>
> I added the nsURI of my metamodel but it does not depend on the Xtext
> project. How can I tell acceleo to use the xtext resource stuff to
> load the file ?
>
> thanks,
>
> julien
Re: [Acceleo/Xtext] Can I use files for concrete models created with xtext2 in acceleo? [message #835152 is a reply to message #835060] Mon, 02 April 2012 17:26 Go to previous message
Eclipse UserFriend
hi Ed,

thanks it works perfectly !

j.
Previous Topic:[SOLVED (+ or -)] JET context.getVariable returning AnyTypeImpl
Next Topic:[acceleo]static uml profile registration
Goto Forum:
  


Current Time: Tue Jul 08 11:24:41 EDT 2025

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

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

Back to the top