Eclipse Tip: Add imports with Code Templates

Code templates have been in Eclipse for a long time. I have blogged about it a long time ago. I have been using it for inserting commonly used statements like logging statements…

When I am inserting a logger declaration I always end up with this:

Eclipse does not know which logger to import. In my case I want it to import the apache logger. Now there is a way you can tell Eclipse to import this automatically. Just edit the code template and add the following:


This is cool and saves a bit of time. :-) For more information on template variables look here.