Eclipse completion template

Someone gave me some  code for a logger auto-completion template that I should use in Eclipse.

After searching on Google and discovering where it is in STS 3.1.0 I added this simple template to auto-complete my logger to use slf4j:

${:import(org.slf4j.Logger, org.slf4j.LoggerFactory)}private static final Logger ${logger} = LoggerFactory.getLogger(${enclosing_type}.class);

This is configurable under the Window -> Preferences -> Java -> Editor -> Templates

 

sts31-editor-template

 

I created a new template that I named logger, context is Java, a description (slf4j logging) and the pattern mentioned earlier.

Quite simple and so convenient that it will remove this bad habit of copying and pasting code with the wrong class name.

 

Advertisements

Published by

m5c

Java developper that loves photography and good coffee

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

w

Connecting to %s