Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Using TMF xText from the commandline
Using TMF xText from the commandline [message #55085] Fri, 03 July 2009 06:07 Go to next message
Louis Stamsma is currently offline Louis StamsmaFriend
Messages: 20
Registered: July 2009
Junior Member
Hello,

I'm new to TMF xText, so forgive if this a no brainer.

- On http://wiki.eclipse.org/MWE_New_Noteworthy it is mentioned that it is
possible to run the generator from the commandline, but it doesn't explain
how to do it. Is it described somewhere else? Or could someone tell me how
to do it?

- Besides being able to run the generator from the commandline, I would
also like to run the workflow that creates the generator and the editor
from the commandline. For this I found some reference to a script, but the
script was so complex that I couldn't distill the essence of it.

- Finally I would like to be able to run the generated editor from the
commandline. Either inside the Eclipse environment or outside of it.
Currently it seems necessary to create a project...

To give some background of my questions, I'm thinking of ways to introduce
TMF xText in a traditional C/C++ style project using make. My thinking now
is to stay as close to the known structure as possible (don't start
building from ANT or...).

Kind regards,

Louis
Re: Using TMF xText from the commandline [message #55195 is a reply to message #55085] Fri, 03 July 2009 09:24 Go to previous messageGo to next message
Sven Efftinge is currently offline Sven EfftingeFriend
Messages: 1823
Registered: July 2009
Senior Member
Hi Louis,

> I'm new to TMF xText, so forgive if this a no brainer.

You're welcome :-)

> - On http://wiki.eclipse.org/MWE_New_Noteworthy it is mentioned that it
> is possible to run the generator from the commandline, but it doesn't
> explain how to do it. Is it described somewhere else? Or could someone
> tell me how to do it?

A brief explanation can be found here :
http://www.eclipse.org/Xtext/documentation/0_7_0/xtext.html# RuntimesetupISetup

But it is very short.
You can use the generated parser through the EMF API.
Writing the following is sufficent in order to get a parsed EMF model
from a file:

TestLanguageStandaloneSetup.doSetup();

ResourceSet resourceSet = new XtextResourceSet();
Resource resource =
resourceSet.getResource(URI.createURI("./mymodel.dsl"), true);
Model rootObject = (Model) resource.getContents().get(0);

//... do stuff with your model

This can be used without OSGi and without any Eclipse workbench
depedendency. All you need is a couple of jars on the classpath (like
EMF, Antlr, Guice, etc,). I've added the list of jars to the end of this
mail.



>
> - Besides being able to run the generator from the commandline, I would
> also like to run the workflow that creates the generator and the editor
> from the commandline. For this I found some reference to a script, but
> the script was so complex that I couldn't distill the essence of it.

It is a matter of writing
new WorkflowFacade("path/to/Workflow.mwe").run();

>
> - Finally I would like to be able to run the generated editor from the
> commandline. Either inside the Eclipse environment or outside of it.
> Currently it seems necessary to create a project...

The editor depends on the workbench, so there might be ways to use it
without projects, it is definitely not something which we did or had in
mind. So sorry I think this is not

>
> To give some background of my questions, I'm thinking of ways to
> introduce TMF xText in a traditional C/C++ style project using make. My
> thinking now is to stay as close to the known structure as possible
> (don't start building from ANT or...).

You need at least a Java process, from where the parser etc. can be invoked.

Cheers,
Sven


Needed jars:

org.eclipse.xtext_0.7.0.v200906222230.jar
org.eclipse.emf.ecore.xmi_2.5.0.v200906151043.jar
org.eclipse.emf.ecore_2.5.0.v200906151043.jar
org.eclipse.emf.common_2.5.0.v200906151043.jar
org.eclipse.xtext.util_0.7.0.v200906222230.jar
com.google.collect_0.8.0.v200906222230.jar
org.antlr.runtime_3.0.0.v200803061811.jar
com.google.guice_1.0.1.v200906222230/aopalliance.jar
com.google.guice_1.0.1.v200906222230/guice-1.0_patched.jar
org.eclipse.xtext.generator_0.7.0.v200906222230.jar
org.eclipse.xtend_0.7.0.v200906230328.jar
org.eclipse.emf.mwe.core_0.7.0.v200906221930.jar
org.apache.commons.logging_1.1.1.v200904062255.jar
org.apache.commons.cli_1.0.0.v20080604-1500.jar
org.eclipse.xpand_0.7.0.v200906230328.jar
org.eclipse.xtend.typesystem.emf_0.7.0.v200906230328.jar
de.itemis.xtext.antlr_0.7.0.200906230945.jar
org.antlr.gen_3.0.1.200906230945/antlr-3.0.1.jar
org.antlr.gen_3.0.1.200906230945/antlr-2.7.7.jar
org.antlr.gen_3.0.1.200906230945/stringtemplate-3.1b1.jar
org.antlr.gen_3.0.1.200906230945
org.eclipse.emf.codegen.ecore_2.5.0.v200906151043.jar
org.eclipse.emf.codegen_2.5.0.v200906151043.jar
org.eclipse.xtext.log4j_1.2.15.v200906222230.jar
org.eclipse.emf.mwe.utils_0.7.0.v200906221930.jar
com.ibm.icu_4.0.1.v20090415.jar
org.eclipse.xtext.xtend_0.7.0.v200906222230.jar
org.eclipse.xtend.util.stdlib_0.7.0.v200906230328.jar
Re: Using TMF xText from the commandline [message #55790 is a reply to message #55195] Sun, 05 July 2009 07:06 Go to previous messageGo to next message
Louis Stamsma is currently offline Louis StamsmaFriend
Messages: 20
Registered: July 2009
Junior Member
Hello Sven,

thanks for your response. I'm about to go and try your suggestions. On the
last point in my posting:


>> - Finally I would like to be able to run the generated editor from the
>>commandline. Either inside the Eclipse environment or outside of it.
Currently >>it seems necessary to create a project...


>The editor depends on the workbench, so there might be ways to use it without
>projects, it is definitely not something which we did or had in mind. So
sorry >I think this is not

I was thinking wouldn't it be possible to sort of wrap the project
creation such that for a user it looks like he can just edit a file...

Better first get the other stuff working :-)

Thanks again,

Louis
Re: Using TMF xText from the commandline [message #458717 is a reply to message #55790] Sun, 02 August 2009 05:10 Go to previous message
Louis Stamsma is currently offline Louis StamsmaFriend
Messages: 20
Registered: July 2009
Junior Member
Hi Sven,

I have been busy with some other stuff, so this project got a bit less
attention. But now I have time to continue with this again.

I have tried running the workflow for the generated generator and after
tweaking the classpath a bit, that works perfectly. Thanks for helping me
completing that step.

I noticed however that the generator doesn't perform any of the model
validation that is done in the editor. So when I make an error in the
model there is no error report.

What should I do to get the model checking and error reporting part of the
generator workflow?

I'm starting to wonder if running the workflow is the best way to do this.
Would it be better to go the ISetup way?

Do you know of an example project where the generated generator is used as
a standalone tool with syntax and semantic error reporting?

Thanks for your help,

Louis
Previous Topic:SemanticHighlighting example
Next Topic:Problems with Negated Token
Goto Forum:
  


Current Time: Fri Dec 27 00:58:40 GMT 2024

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

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

Back to the top