Following Wayne Beaton’s post on more templates with eclipse, here is an example of template that I extensively use in eclipse to ease logging statements.
For each logging level (debug, info, warn, error, fatal), I defined a corresponding templates.
For example, I have a debug template:
if (logger.isDebugEnabled()) {
logger.debug(${cursor});
}
It makes it simpler and quicker to write logging statements. However the class won’t compile if a logger field has not already been defined. But in that case, either you can use eclipse’s quick fix… or create a new template to define the logger.
