Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » TMF (Xtext) » Call the generator from the eclipse application, passing an argument which determines the output tem
Call the generator from the eclipse application, passing an argument which determines the output tem [message #737148] Fri, 14 October 2011 18:05 Go to next message
Ariel Santana is currently offline Ariel SantanaFriend
Messages: 11
Registered: April 2010
Location: Buenos Aires, Argentina
Junior Member
hello
need to perform a task orientation

the idea is as follows: I wish to call the generator from the eclipse application, passing an argument which determines the output template.

launch the project as an application xtext eclipse (this works: I file shows the syntax highlighter, run the @ Check, etc..), so far wrong.

not change how or where to run the workflow (the generator) is within the project "u"?

could use the method
protected void runGenerator (String string)
Main.java class?

from already thank you very much
Re: Call the generator from the eclipse application, passing an argument which determines the output [message #737171 is a reply to message #737148] Fri, 14 October 2011 18:39 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi, do you mean calling the generator from an eclipse handler? Do you
want to generate from one model or multiple. Basically a Xtend
generator is simply a javaclass you can use. Can you elaborate a bit
what you exactly want to do ?


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call the generator from the eclipse application, passing an argument which determines the output [message #737425 is a reply to message #737171] Sat, 15 October 2011 02:05 Go to previous messageGo to next message
Ariel Santana is currently offline Ariel SantanaFriend
Messages: 11
Registered: April 2010
Location: Buenos Aires, Argentina
Junior Member
Christian Dietrich wrote on Fri, 14 October 2011 15:39
Hi, do you mean calling the generator from an eclipse handler? Do you
want to generate from one model or multiple. Basically a Xtend
generator is simply a javaclass you can use. Can you elaborate a bit
what you exactly want to do ?


I have a DSL, and when you run the Eclipse, there will be another eclipse where I can use the IDE features (syntax highlighting, @ check, auto, etc.).

once created the file test.mydsl, I wish I could call that file generator (click the right mouse button, or some option in the menu).

as shown in the attached image, you can create an option, for example, "Run transformation ..." and to run a Java method call to run the generator:

index.php/fa/4303/0/

protected void runGenerator (String string) {
/ / Load the resource
ResourceSet resourceSetProvider.get set = ();
Resource resource = set.getResource (URI.createURI (string), true);

/ / Validate the resource
List list = validator.validate <Issue> (resource, CheckMode.ALL,
CancelIndicator.NullImpl);
if (! list.isEmpty ()) {
for (Issue issue: list) {
System.err.println (issue);
}
return;
}

/ / Configure and start the generator
String basePath = "__" + PSMProperties.get_name ();
fileAccess.setOutputPath ("src-gen" + basePath);
generator.doGenerate (resource, FileAccess);

System.out.println ("Code generation finished.");
}


Please excuse my English, I'm using an automatic translator
  • Attachment: example.png
    (Size: 135.33KB, Downloaded 265 times)

[Updated on: Sat, 15 October 2011 02:06]

Report message to a moderator

Re: Call the generator from the eclipse application, passing an argument which determines the output [message #737602 is a reply to message #737425] Sat, 15 October 2011 07:30 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

If i understand you correct this is not.a Xtext related problem. Just write your handler class, Inject the igenerator there, and call it. or write a laucher or whatever the eclipse means is for a runconfig.
So searching the forum/the Web for eclipse command / Handler should give you tons of code on how to do a Context Menu entry.

Regards Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call the generator from the eclipse application, passing an argument which determines the output [message #737635 is a reply to message #737602] Sat, 15 October 2011 08:28 Go to previous messageGo to next message
Christian Dietrich is currently offline Christian DietrichFriend
Messages: 14661
Registered: July 2009
Senior Member
Hi,

i took the time a wrote a small blog post on this http://christiandietrich.wordpress.com/2011/10/15/xtext-calling-the-generator-from-a-context-menu/

~Christian


Twitter : @chrdietrich
Blog : https://www.dietrich-it.de
Re: Call the generator from the eclipse application, passing an argument which determines the output [message #737822 is a reply to message #737635] Sat, 15 October 2011 13:53 Go to previous messageGo to next message
Cintia Coni is currently offline Cintia ConiFriend
Messages: 1
Registered: June 2010
Location: La Plata, Buenos Aires
Junior Member
Thank you Christian! Razz
Re: Call the generator from the eclipse application, passing an argument which determines the output [message #743499 is a reply to message #737822] Fri, 21 October 2011 14:34 Go to previous message
Ariel Santana is currently offline Ariel SantanaFriend
Messages: 11
Registered: April 2010
Location: Buenos Aires, Argentina
Junior Member
Hi Christian, is exactly what I needed, many thanks
Previous Topic:migration to xtend2
Next Topic:Xbase and dynamic meta-models
Goto Forum:
  


Current Time: Fri Mar 29 02:16:30 GMT 2024

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

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

Back to the top