Eclipse Auto Complete Templates for ATG

Home/Java/Eclipse Auto Complete Templates for ATG

Eclipse has an often under-utilized feature called Templates. You’ve probably used the built in templates when Eclipse auto-completes for loops or try-catch blocks, etc… However, you can create your own templates for commonly used chunks of code. This can save you a lot of time, and more importantly can facilitate you writing better quality code.

ATG Eclipse Templates

ATG Eclipse Templates

By making commonly used code blocks available with a couple of keystrokes it is much easier to write best practices code, that otherwise you might shortcut around.

You can view, import, and create new templates by going to Eclipse’s Preferences, then opening Java->Editor->Templates. Each Template has a Name, this is what triggers it for auto-complete so making this simple and unique is good, a Description, a Context, a checkbox to Automatically insert, and then the Pattern which is the code that will get inserted for you. Within the Pattern you have access to a substantial number of variables, such as the current class or method name, variables, method arguments, dates, etc… which allow you do some very useful things.

For ATG coding I’ve created nine Templates for common code blocks.

My templates isBlank and isNotBlank create if blocks based on ATG’s StringUtils.isBlank method, which checks for null, empty, or blank Strings. Checking Strings is something that I do all the time (validating user input, query params, etc…) so being able to do it in a few keystrokes is very useful.

ls.isBlank(${cursor})) {


I have three templates for ATG Performance Monitor operations. Adding in ATG Performance Monitor hooks when you’re coding can make diagnosing performance problems later much easier. Using templates means you don’t have to remember the syntax or even type in the class and method names:

PerformanceMonitor.startOperation("${enclosing_type}", "${enclosing_method}");

I also have four templates for the primary ATG logging methods with the respective if blocks needed to prevent unnecessary String concatenations.

if(isLoggingDebug()) {
	logDebug("${enclosing_type}.${enclosing_method}:" + "${cursor}");

I’ve exported these nine ATG templates so you can easily import and start to use them.
Eclipse ATG Coding Templates.

What templates have you created?

By | 2017-05-18T15:16:12+00:00 September 2nd, 2009|Java|4 Comments

About the Author:


  1. John March 24, 2010 at 5:49 am - Reply

    Hey Devon, Thanks for all the great tips. I was wondering what version of Eclipse you are using with ATG? And, do you use the ATG-provided Eclipse plugin? 3.4 and 3.5 have been out for a long time now, but ATG only has a plugin for 3.3 available? Really wanting to use it with 3.5 since the JSP editing features are so much better…

    • Devon March 24, 2010 at 6:32 am - Reply


      I don’t use the ATG plugin for a few reasons: the 3.3 requirement is one of them, I also really dislike how it expects you to manage your project and module location. Sometimes I miss the Repository definition editor, but that’s it.

      Currently I’m using MyEclipse 8.5, which is based on Eclipse 3.5. I really like it, and it’s worth the money for me. Although a few months ago I was just using Eclipse 3.5 combined with the JBoss Tools and several other plugins and that works pretty well.

      The upside of the newer Eclipse versions heavily outweigh losing the ATG plugin for me.

      FWIW, my favorite plugins are: Jadclipse, Subclipse, JAutodoc, Mylyn/Jira, JBoss Tools, Checkstyle, FindBugs, Regex Util.

  2. Deezer August 16, 2010 at 5:40 am - Reply

    Devon, Do you put performance monitor calls in every method, or just select methods?

    • Devon August 16, 2010 at 7:59 am - Reply

      Just select methods. Anything that I think I may want to check on later: External system calls, remote API calls, complex/expensive operations (bulk loading data, handing large XML files), critical parts of the primary user experience, etc..

Leave A Comment