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 |
|
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 #737425 is a reply to message #737171] |
Sat, 15 October 2011 02:05 |
|
Christian Dietrich wrote on Fri, 14 October 2011 15:39Hi, 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:
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
|
|
| | | | |
Goto Forum:
Current Time: Fri Mar 29 02:16:30 GMT 2024
Powered by FUDForum. Page generated in 0.02995 seconds
|