I want to run an Acceleo Project from an Installed Plugin. i.e. I want to be able to generate with a Acceleo Template in the Workspace from a Eclipse Plugin I have made.
Currently, I have an Acceleo project which I run from my Eclipse Plugin programmatically:
try {
final File outputDir = new File("C:/outputDir/");
List<String> arguments = new ArrayList<String>();
/*fc is an instance of a EMF Compare Comparison object
* the nsURI for it is http://www.eclipse.org/emf/compare
*/
Generate generator = new Generate(fc, outputDir, arguments);
generator.doGenerate(new BasicMonitor());
} catch (IOException e) {
e.printStackTrace();
}
The template is simple at the moment:
[comment encoding = UTF-8 /]
[module generate('http://www.eclipse.org/emf/compare')]
[template public generateElement(comparison : Comparison)]
[comment @main/]
[file ('update.sql', false, 'UTF-8')]
/*SQL UPDATE SCRIPT TEST*/
[comparison.getDifferences().toString() /]
[/file]
[/template]
This generates perfectly.
The issue is that I need to deploy the plugin but I still need end users to be able to modify the templates. The end goal is to have the Acceleo project in the end users' Workspace and let my plugin call it at runtime, but no matter how I set it up, I have to include the Acceleo project in my Plugin Feature.
Things I have attempted:
Overriding the Acceleo Module from a project in the end users workspace
Various attempts with java class loaders - I feel this is the way to go but I can't seem to get a working example
I am running:
Eclipse Luna SR2 (4.4.2)
Windows 7 Pro - 64bit - SP1
Acceleo 3.5.1.201409021433
JRE 1.8.0_45