|
|
Re: How to create plugin to execute egl files [message #1063147 is a reply to message #1063122] |
Wed, 12 June 2013 13:33 |
|
If I have understood it correctly, you have the Java code required to run the transformation, and you'd like to invoke it from a wizard where the user can select a model, right?
I think you might get better help from the PDE forum, but in any case, here is a tutorial that might help you on creating a plugin with a wizard:
http://www.vogella.com/articles/EclipseWizards/article.html
You could use the last step to set up a new IProject and run the transformation there. You should only have to define a dependency from the wizard plugin to the transformation plugin.
Creating a project programmatically is not hard. You could do something like in this createProject(...) method:
http://goo.gl/qSHGp
|
|
|
Re: How to create plugin to execute egl files [message #1063152 is a reply to message #1063147] |
Wed, 12 June 2013 13:42 |
Patricia Fernández Messages: 41 Registered: October 2012 |
Member |
|
|
Thank you Dimistris, I will try that and see if it works as I need to.
Antonio Garcia-Dominguez wrote on Wed, 12 June 2013 09:33If I have understood it correctly, you have the Java code required to run the transformation, and you'd like to invoke it from a wizard where the user can select a model, right?
Hi Antonio,
I currently have the EGL/EOL files, uml file, java tools (as a jar in the dropins folder) and the launch configuration file to run the egl templates.
Then, what I need to do first is create the java code to run the transformation and then create a wizard which uses said java code, am I right?
Thank you both for the help.
|
|
|
|
|
|
Re: How to create plugin to execute egl files [message #1063564 is a reply to message #1063542] |
Thu, 13 June 2013 12:21 |
Patricia Fernández Messages: 41 Registered: October 2012 |
Member |
|
|
Thanks, it seems that there is one line that isn't working (Package.Registry.INSTANCE.put(UMLPackage.eNsURI, UMLPackage.eINSTANCE);).
import org.eclipse.uml2.uml.Package;
import org.eclipse.uml2.uml.UMLPackage;
...
if (inputFile.getName().endsWith(".uml")) {
UmlModel model = new UmlModel();
model.setName("UMLModel");
Package.Registry.INSTANCE.put(UMLPackage.eNsURI, UMLPackage.eINSTANCE);
model.setMetamodelUri(UMLPackage.eNsURI);
model.setModelFile(inputFile.getAbsolutePath());
model.load();
generate(model, inputFile.getParentFile());
model.disposeModel();
}
And also here (module.parse(CodeGenerator.class.getResource("CodeGenerator.egx").toURI());
module.getContext().getModelRepository().addModel((IModel) model))
protected void generate(UmlModel model, File directory) throws Exception {
...
module.parse(CodeGenerator.class.getResource("CodeGenerator.egx").toURI());
module.getContext().getModelRepository().addModel((IModel) model);
if (generatePluginXml) {
Also, does .egx file mean that all the generate commands I have in my code need to be re-done in some way?
For example, I got the following simplified bunch of lines in one of my templates:
var t := TemplateFactory.load('One.egl');
t.generate (secondleveldirectory+'\\'+modelProject.name+'.java');
Do I need to add the template 'Example.egl' which contains those lines, to the .egx file?
[Updated on: Thu, 13 June 2013 12:59] Report message to a moderator
|
|
|
|
Re: How to create plugin to execute egl files [message #1063786 is a reply to message #1063732] |
Fri, 14 June 2013 09:04 |
Patricia Fernández Messages: 41 Registered: October 2012 |
Member |
|
|
Package.Registry.INSTANCE.put(UMLPackage.eNsURI, UMLPackage.eINSTANCE);
Quote:Registry cannot be solved or is not a field
module.parse(CodeGenerator.class.getResource("CodeGenerator.egx").toURI());
module.getContext().getModelRepository().addModel((IModel) model)
Quote:The type org.eclipse.epsilon.erl.ErlModule cannot be resolved. It is indirecty referenced from required .class files
[Updated on: Fri, 14 June 2013 09:05] Report message to a moderator
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.04636 seconds