|
Re: [Xpand] Change Templates at Runtime [message #1220700 is a reply to message #1219668] |
Fri, 13 December 2013 07:43 |
Sven Efftinge Messages: 1823 Registered: July 2009 |
Senior Member |
|
|
With Xpand there is no other way than using its AOP feature to configure
different implementations from outside.
If you've just started to implement your code generator,
I strongly suggest to use Xtend (www.xtend-lang.org) instead, as it will
allow you to solve this easily with dependency injection and it has
numereous other advantages.
Sven
Am 12/5/13 2:34 PM, schrieb Phi Fa:
> Hi guys,
> I'm totally new to Xpand and have the following problem.
>
> I work on an Eclipse Application, which also generates code via Xpand
> from an EMF Model.
>
> Now I want to change some templates of the codegeneration at
> applications runtime, but before the codegenerator starts. The main
> application is extended with some plugins which can change at runtime,
> but every time only one plugin is running (singleton). The current
> running plugin shell provide the concrete template.
>
> For example:
>
> File A (main template):
>
> ..
> «DEFINE A FOR Element»
> «EXPAND FileB::B»
>
>
> Plugin 1
> File B (dynamic template provided by plugin):
>
> «DEFINE B FOR Element»
> //some stuff
>
>
> Plugin 2:
> File B (dynamic template provided by plugin):
>
> «DEFINE B FOR Element»
> //some stuff
>
>
> The problem is at the moment I don't have a really good idea how to do
> it right and nice....
>
> My ideas:
>
> The names and location of the templates provided by the plugin are
> always the same.
>
> I was hoping, it is possible to refer to another template from the main
> template via a path, but it seems, this isn't possible.
>
> Another idea is to modify the bundles jar at runtime and store the
> dynamic templates in the same package as the main template. At the
> beginning in this package are some default dynamic templates. I don't
> know if it is possible to modify a bundle at runtime and this would be a
> solution I don't prefer.
>
> Is there a way to tell the codegenerator to look in a defined directory
> for getting the dynamic templates?
> Or anyone has a better idea?
>
> Regards
>
>
>
>
>
>
>
>
--
Need professional support for Xtext or other Eclipse Modeling technologies?
Go to: http://xtext.itemis.com
Twitter : @svenefftinge
Blog : http://blog.efftinge.de
|
|
|
Powered by
FUDForum. Page generated in 0.03807 seconds