Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Xtext -> XPand Workflow - How to for new Eclipse version(Xtext -> XPand Workflow - How to for new Eclipse version)
Xtext -> XPand Workflow - How to for new Eclipse version [message #721355] Thu, 01 September 2011 14:40 Go to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi Supporters,

I want to prototypically realize a tool chain for MDSD for a software development division because of my master thesis. I read many books and other sources so far and know I decided to realize the following tool chain: Xtext for creating the grammar and for modelling the concret model (in the generated editor), after that code generation with XPand.

My Problem is that I only found old documentations like help.eclipse.org/helios/index.jsp which do not work for the newest version of eclipse (I have installed the SDK 3.70). At this side is descriped that I have to activate the checkbox for the option "Create a generator project" while creating a new Xtext project. But this check box isn't existing anymore and the generated file system is totally different from one descripted in the tutorial. At the actual Xtext-documentation from the official site there is only an example for Xtend descriped. But if I understood things right this is no language for M2T transformation.

Is there any good tutorial which works with the actual version of eclipse? Or is there any other way to help me? I searched for any other tutorial or anything else the whole day but I did not found anything which descriped how to realize such a workflow.

I would be pleased for any answer and thanks in advance Smile
Jonnyboy

[Updated on: Thu, 01 September 2011 14:41]

Report message to a moderator

Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721364 is a reply to message #721355] Thu, 01 September 2011 15:10 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

it should be not problem to use xpand.
what about downloading a Eclipse Helios with Xtext+Xpand and take the generator code from there and port it to Indigo?

But Xtend is of course for M2T have a look at the domain model example.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 01 September 2011 15:12]

Report message to a moderator

Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721376 is a reply to message #721364] Thu, 01 September 2011 15:39 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi Christian,

Thank you for your reply Smile

"what about downloading a Eclipse Helios with Xtext+Xpand and take the generator code from there and port it to Indigo?"
=> Do I understand you right? I should make the code generation in an older version and put the generated code to an newer version (I don't think you ment that). The thing is that I do not know how to generate code out of the newly models composed models. Until now I know that you have to write a xtext-file (in EBNF style) and after that you start a new eclipse workbench with "Run as" option -> there the newly created grammar is plugged in and you can write your own models with the new DSL. I do not know how what is the next step in Indigo.

"But Xtend is of course for M2T have a look at the domain model example."
=> I recognized that because a tutorium (actual Xtext documentation) gave an example. But in other books an sites is descripted that this language is for M2M transformation and to write extensions which can be called while constraint checks and via code generation (www.voelter.de/data/articles/CarpeDiem.pdf). That is confusing. Does anybody knows which language is better for M2T (C# and XML-code generation)?
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721377 is a reply to message #721376] Thu, 01 September 2011 15:45 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

(1) what i mean: if you need code to copy & paste to get the workflow setup do copy & paste from Helios. I'd write the workflow from scratch
(2) There is Xtend(2) / Xtexts Xtend that differs from oAW/EclipseM2T Xpand/Xtend(1)
so the new Xtend2 is for M2T too.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Thu, 01 September 2011 15:48]

Report message to a moderator

Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721398 is a reply to message #721377] Thu, 01 September 2011 16:30 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi,

Thanks again for the answer. I think with (1) you ment those mwe2-files which I have to write. If yes I would read an tutorial who to write this files and hope that helps.

But what I stll do not get: In the old tutorials there was an autogenerated Projekt where you could put in your file where the new model was descriped (folder src/model) and than you could put xtend and xpand-files into the same projekt (src/templates) (help.eclipse.org/helios/topic/org.eclipse.xtext.doc/help/images/generator-project.png). After that you rewrote the mwe2-file -> ok. Now, there is no such a project generated in Eclipse 3.7 anymore. So where do I have to put the XPand file which desripes the M2T transformation to (I mean in which folder of the Xtext project). Or how can this work? Sorry, the question is pretty basic but like I said: I really do not find a proper documentation for this use case.

Again thanks in advance for any answer,
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721399 is a reply to message #721398] Thu, 01 September 2011 16:34 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

its quite easy: you can put it anywhere Smile even onto the moon.

you create a new plugin project (maybe name it yourdsl.generator)
you add dependency to your dsl plugin to that plugins manifest.
you write your workflow + templates and stuff there and be happy.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #721406 is a reply to message #721399] Thu, 01 September 2011 16:48 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi,

Nice joke Very Happy

Ok, I will try that out tomorow. Until than thanks again for your nice support
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722093 is a reply to message #721406] Sun, 04 September 2011 12:07 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hello again,

Ok, I read the mwe2-Tutorial. Now I want to do the following:
I created an Xtext-Projekt and defined a grammar. Now I created a XPand-Project and added the dependencies of the xtext-plugin like Christian said to the plugin-manifest and wrote an mwe2-file which should work. The Problem is now that the XPAND-file.
«IMPORT org::eclipse::xtext::example::domainmodel»
=> eclipse cannot handle this import (namespace is unknown) although I simply used only the names of the tutorial.
«DEFINE main FOR Entity-»
=> he will not know Entity in this line which is part of my grammar defined in the xtext project
The strange thing is that if I rename the import to «IMPORT domainmodel» Entity and all other parts of my defined grammar ar recognized although I wrote
"grammar org.eclipse.xtext.example.Domainmodel
with org.eclipse.xtext.common.Terminals"
in the .xtext file (and therefore all files which represent the grammar e.g. the ecore-file are named Domainmodell)???

The second problems occured after I renamed the import like descriped above. In the xpand-file there I copy&pasted the following lines of the tutorial
«DEFINE main FOR Entity-»
«FILE qualifiedName().replaceAll("\\.","/")+".java"-»
package «packageName()»;

public class «name» {
«EXPAND property FOREACH features»
}
«ENDFILE»
«ENDDEFINE»

=> here he does not knows what "packageName()" is.

And in the xpand-file there is the same problem (here I also named the import like descriped above):

import domainmodel;

packageName(Type this) :
qualifiedName(eContainer());

packageName(Void this) : null;

String qualifiedName(Object this) : null;

String qualifiedName(Type this) :
packageName()==null? name : packageName()+"."+name;

String qualifiedName(PackageDeclaration this) :
if qualifiedName(eContainer())==null
then name
else qualifiedName(eContainer())+'.'+name;

=> here he dosn't know "packageName()" and "eContainer()". I googled and found out that eContainer could be a method of org.eclipse.emf.ecore.EObject so I imported every single plugin which was named org.eclipse.emf.ecore... (only an experiment) but nothing changed.

Can anyone help me -> like I said I only tried out the tutorial eclipse.org/Xtext/documentation/1_0_0/xtext.html#getting-started-xtext and I simply copy&pasted the code from the site so therefor there should be no "wrong naming errors".

Thanks in advance
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722096 is a reply to message #722093] Sun, 04 September 2011 12:21 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i guess you missed one keypoint in Xpand: Xpand Support different kinds of MetaMetamodels. You can even contribut your own if you like. One is Javabeans Metamodel which has imports "full::qualified::java::package::name". Another is the (dynamic) EMF Metamodel wich has imports "packagename". you can set the metamodel used in the differen workflow components in the workflow (default is JavaBeans) and in your generator projects Xpand/Xtend properties.

If you'd inially changed it to JavaBeans the long package name world work as well as the extensions that cound not be found.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722100 is a reply to message #722096] Sun, 04 September 2011 12:38 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi and thanks again,

I looked in the project settings and only EMF is checked. But for the beginning that is fine for me. But why he checks the one import statement without the full qualified name of the path: "import domainmodel;"
and the other expression not: "import org::eclipse::xtext::example::domainmodel;"?
Such things like: "import org.eclipse.xtext.example.domainmodel;" do not work...

And does someone knows what I have to do so these funktion calls in my xpt and ext-files work (for example eContainer())?

Thanks in advance
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722102 is a reply to message #722100] Sun, 04 September 2011 12:44 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

emfmetamodel => domainmodel
javabeansmetamodel => org::eclipse::xtext::example::domainmodel or what ever the fiull qualified package name is in your case

what about give autocomplete a chance and finding out that .eContainer works?


Please note that you will have to configure the use of EMFMetamodel in your workflow too. e.g

	component = org.eclipse.xpand2.Generator {
		metaModel = org.eclipse.xtend.typesystem.emf.EmfMetaModel {
			metaModelPackage = "org.xtext.example.mydsl.myDsl.MyDslPackage"
		}
		...
	}



But i reccoment to use javabeans metamodel since it is default.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de

[Updated on: Sun, 04 September 2011 12:59]

Report message to a moderator

Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722108 is a reply to message #722102] Sun, 04 September 2011 13:32 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi and THX again,

ok, sorry, but this will be even more easy for you. I don't know what with what string I have to set the "metaModelPackage =". I tried every combination out which could make sense but it don't work. Because the documentation said (and the error says that a class could not be found) tried to find out which class has to be refered but in my project folders there is no class which fits to the needs (e.g. I thought that the class could be derivated of EPackage because this was also mentioned in the documentation).

Short: I don't know which file or source or whatever else metaModelPackage wants and I do not find a proper explaination in the internet.

Can somebody help? I really tried to find it out by myself...

THX in advance
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722110 is a reply to message #722108] Sun, 04 September 2011 13:37 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

i guess reading some tutorials on emf can help.
xtext dereives a ecore metamodel from your grammar. from this ecore java classes (model code) is generated through a genmodel. thus you can find in your dsls runtimeproject a class YourdslPackage. the name is this classes full qualified name.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722113 is a reply to message #722110] Sun, 04 September 2011 13:53 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi Christian,

You are my hero Very Happy

Of course this class exists and it derivates of EPackage - I'am blind... and it worked! Uff, ok the entrance to this mdsd thing will not be that easy as I hoped.

Still I got one question refering to a question above. The tutorial I'm working with said eContainer() but after your advise (auto completion) I deleted the "()" and it worked. Could it be that this is also a notation for JavaBeans meta-metamodel?

THX in advance
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722114 is a reply to message #722113] Sun, 04 September 2011 13:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

yes - in javabeans its an operation all thus the ()s. In EMF ist a kind of hardcoded member, thus no ().

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722123 is a reply to message #722114] Sun, 04 September 2011 14:44 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi, THX and another one.

I know that if I start a new workbench with "run as" out of a workbench and you create a new file with an extension which indicates that this file will descripe a concrete model by the help of your grammar you will get syntax highlighting and all the other features for defining your model (after you added xtetx nature).

Is it possible to get this feature also without the "run as" trick? I have my xpand project, xtext and xtext/xpand-nature are added and the xtext project (and the ui project) are added as dependencies. But unfortunatly no syntax highlighting Sad Is there a way to still enable this nice feature?

Tanks in advance
Jonnyboy
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722124 is a reply to message #722123] Sun, 04 September 2011 14:53 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

you can export yourdsl and yourdsl.ui plugins with the rightklick export -> as deployable plugins and fragments to your eclipse dropins folder and restart eclipse. or you import the generator project into the eclipse started with runas.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722135 is a reply to message #722124] Sun, 04 September 2011 15:50 Go to previous messageGo to next message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi,

I had my xtext projects opened in the workbench and exported the plugin and imported the plugin after restarting. Unfortunatly I did not recognized that through the import my original project would be deleted -> but that is my fault...

Now many new errors occured:
register = org.eclipse.xtext.example.DomainmodelStandaloneSetup {} of course cannot work because the file was deleted. And in the xpand-file he also don't likes many things. At least syntax highlighting seems to be working now...

=> if I recreate my old deleted xtext project -> is there really a way to generate things and get highlighting without run as? Because if you import the exported plug-in you have to decide between the exported plugin and the original one (which have the same name) -> and you need the original project to do stuff like register = org.eclipse.xtext.example.DomainmodelStandaloneSetup {} I think but you also need the exported plugin so that the syntax highlighting works. Only to add the dependncies of th original projets didn't work (to activate syntax highlighting)

Tanks in advance
Jonnyboy

[Updated on: Sun, 04 September 2011 15:54]

Report message to a moderator

Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722138 is a reply to message #722135] Sun, 04 September 2011 15:55 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14665
Registered: July 2009
Senior Member
Hi,

am not sure what you are doing. maybe a tutorial on plugin development in general can help.
if you want to install the dsl plugins in your host eclipse you
(1) have to export them as deployable plugins
(2) install it e.g. by copying them into the dropins folder of your eclipse.

With importing i meant the generator plugins, not the dsl plugins.

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Xtext -> XPand Workflow - How to for new Eclipse version [message #722148 is a reply to message #722138] Sun, 04 September 2011 17:51 Go to previous message
Johnnyboy  is currently offline Johnnyboy Friend
Messages: 39
Registered: September 2011
Member
Hi,

Thanks to Christian now everything works. I had to make all projects new and copy&pasted the code and afterwards everything worked (with exactly the same code!).

Have a nice day
Jonnyboy
Previous Topic:Examining the tree structure of XtextEditor's document
Next Topic:Fix for Bug 349992 does not fix "Too many constants error in generated internalXXXParser.java&q
Goto Forum:
  


Current Time: Thu Apr 18 20:36:06 GMT 2024

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

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

Back to the top