Are static JET templates useable? [message #1801689] |
Thu, 24 January 2019 18:07 |
Ed Willink Messages: 7655 Registered: July 2009 |
Senior Member |
|
|
Hi
(DynamicTemplaes, GenModel.dynamicTemplates = true, cause the GenModel.templateDirectory to be compiled to the .JETEmitters project and used from there during genmodel *.java synthesis. Good. Unfortunately dynamic templates do not work standalone since Eclipse bundle functionality is used to run the JET compiler.)
Static templates, GenModel.dynamicTemplates = false, should, according to https://bugs.eclipse.org/bugs/show_bug.cgi?id=147318, allow the GenModel.templateDirectory to specify already compiled templates bypassing the need for and problems of running the JET compiler. Comment #2 helpfully observes that ALL templates in a package must be defined to ensure that the user package displaces the EMF package. But for me, my 'better' package is last on the classpath, so even though my templates are passed first to JETEmitter, the class loader loads the standard EMF templates regardless. When launching standalone, I could contrive a biased class loader that favours my package, but I would like the genmodel to work just the same interactively. Does EMF need to use a biased class loader?
Can static templates be used?
Workaround. I currently use a different package name for which a GenModelGeneratorAdapterFactory can provide distinctive JET_DESCRIPTORS. Works fine when my standalone code registers the replacing GenModelGeneratorAdapterFactory locally. Also works fine if a complementing GenModelGeneratorAdapterFactory registers complementary templates globally.
But how to register replacement templates globally? The only way I can see is to use a distinctive GenModel nsURI for which the replacements can then be globally registered. But this doesn't exploit static templates.
Am I missing something?
Regards
Ed Willink
|
|
|
|
|
Re: Are static JET templates useable? [message #1801712 is a reply to message #1801711] |
Fri, 25 January 2019 06:59 |
Ed Merks Messages: 33137 Registered: July 2009 |
Senior Member |
|
|
Yes, overall the dynamic templates design requires bundles. Unfrotuantely, I don't understand the dynamicTemplates=false scenario; that just does nothing (is intended to do nothing). I.e., there isn't intended to be a replacement package in this case. But you seemed to imply up front that you found some way to hack a stand alone scenario that somehow does something you want even in this case, though I'm explaining to you that the intent is that dynamicTemplates=false does nothing and that dynamicTemplate=true does something: It will compile the templates on the path (platform:/resource/...) ; that only works with a workspace and JDT doing the compilation. Alternatively, it can load existing compiled templates from a bundle (platform:/plugin/...); that only works if we have bundles. None of this is designed to work without bundles, and none of it is designed , and intend, to do anything dynamic when dynamicTemplates is false.
Perhaps you can use your workaround approach to make this also work for standalone. So perhaps it's good to try it first for the non-standalone case, and then see how you might use a similar approach to also work standalone.
Ed Merks
Professional Support: https://www.macromodeling.com/
|
|
|
|
|
Powered by
FUDForum. Page generated in 0.03145 seconds