|
Re: Applying conditions to code templates (code generation) [message #329625 is a reply to message #329445] |
Mon, 30 June 2008 13:55 ![Go to previous message Go to previous message](theme/Solstice/images/up.png) |
john![Friend of Eclipse Friend](/donate/web-api/friends_decorator.php?email=johndoeroe%40hotmail.com) Messages: 10 Registered: July 2009 |
Junior Member |
|
|
Well, in the interest of enlightening future plugin developers, I'll
contribute what progress has been made here.
Templates, TemplateContexts, ContextTypes, and TemplateVariables are used
to resolve a template pattern into actual code generation.
ContextTypes hold template variables, which work together to resolve a
context into actual content.
There's a "general" TemplateContextType registry and a
CodeTemplateContextType registry. The JavaPlugin has a method for
retrieving these registries, like the one below.
JavaPlugin.getDefault().getCodeTemplateContextRegistry()
You can retrieve the registry, and replace the registry types with your
own ContextTypes. The CodeTemplateContextRegistry contains all the
TemplateContextTypes used in Windows>Preferences>Java>Code
Style>Templates. This is pretty useful, but only so useful.
Unfortunately, a "new class wizard" uses ContexTypes and variables to
resolve everything BUT the superclass, which is what I'm endeavoring to
use. The new class wizard tweaks the autogenerated content afterwards,
plugging in the superclass and implementation information without using
templates at all.
It appears to accomplish my purposes, it would be necessary to hook the
new class file wizard. If anyone has any pro-tips on how to do this, I'm
all ears.
|
|
|
Powered by
FUDForum. Page generated in 0.03876 seconds