[Acceleo 3] Overriding Templates [message #656426] |
Fri, 25 February 2011 15:22  |
Sylvain Dudoit Messages: 5 Registered: February 2011 |
Junior Member |
|
|
Hi,
I'm using Eclipse 3.5.2 with Acceleo 3.0.1.
Here is my situation :
- I have "plugin A" which implements "Documentation.mtl A" for elements of "meta-model A"
- "Documentation.mtl A" contains a template "generateElementDoc(e : Element)"
- I have "plugin B" which implements a "meta-model B" which extends "meta-model A"
I want to :
- Implement the generation action in "plugin A" which launches "Documentation.mtl A"
- I want to overrides "generateElementDoc(e : Element)" in "plugin B" to consider subclasses of "Element" (e.g. let's call it "SubElement")
After reading the documentation of Acceleo, I thought my solution could be :
---- Documentation.mtl A ----------------------------------------
[module Documentation('metamodelA.uri')/]
[template public generate(m : Model)]
[comment @main /]
[file ('index.html', false, 'UTF-8')]
[for (e : Element | m.elements)]
[generateElementDoc(e)/]
[/for]
[/file]
[/template]
[template public generateElementDoc(e : Element)]
Hello, I'm an Element
[/template]
---- Documentation.mtl B ----------------------------------------
[module Documentation('metamodelB.uri') extends pluginA::Documentation/]
[template public generateElementDoc(e : SubElement) overrides generateElementDoc]
Hello, I'm a SubElement
[/template]
But, I get an error under the second "generateElementDoc" in "Documentation.mtl B" which is saying
"No public template 'generateElementDoc' found." even if the package containing Documentation.mtl A
is exported.
Where am I wrong ?
The last question is : since "plugin A" which implements the action doesn't know "plugin B", I will have to
use "dynamic template" extension for declaring "Documentation.mtl B" ?
Thank you for your answers,
Sylvain
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.01911 seconds