Home » Eclipse Projects » Eclipse Platform » Applying conditions to code templates (code generation)
|
Re: Applying conditions to code templates (code generation) [message #329625 is a reply to message #329445] |
Mon, 30 June 2008 09:55  |
Eclipse User |
|
|
|
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.
|
|
|
Goto Forum:
Current Time: Thu May 01 21:11:30 EDT 2025
Powered by FUDForum. Page generated in 0.03203 seconds
|