How to create plugin to execute egl files [message #1063122] |
Wed, 12 June 2013 07:59  |
Eclipse User |
|
|
|
Hi,
I'm such a newbie in this environment, so if my question it's silly I'm sorry.
I created a buttom and a menu in the Eclipse's toolbar to apply the transformation from uml to C#. What I need is to create a... maybe a wizard? a plugin?... where I can show a window and let the user choose the source file (which is going to be the .uml model to transformate) and then apply the EGL templates I created to generate the C# code project.
The transformation from UML-code is already done and tested with a launch file. Also, I created few java tools (for exceptions, warnings, to choose between different models in the same file...) and wonder if those are compatible with what I need to create?
How can I do that? Could anyone help me where to start? I'm a bit lost.
Thanks in advance.
|
|
|
|
|
Re: How to create plugin to execute egl files [message #1063152 is a reply to message #1063147] |
Wed, 12 June 2013 09:42   |
Eclipse User |
|
|
|
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 08:21   |
Eclipse User |
|
|
|
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 08:59] by Moderator
|
|
|
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.05077 seconds