Eclipse ASDT Editor Templates

I must confess that I’ve been an avid Flash blog reader for some time now, but had been too lazy (and perhaps a bit insecure) to set my own up. However, I realized the time had come when I started emailing Jesse Warden aka Jester XL with “ideas” for him to blog–Jesse’s response was, per norm, funny as hell, “dude, blog it yourself.” And so here I am posting the “blog idea” that I was pestering Jesse with.

Like many in the Flash community, I began playing around with the Eclipse platform, ASDT editor, MTASC and Flashout (“FAME” ala Jesse) back in March following Carlos Rovira’s excellent article detailing installation, configuration and use. However, as someone with a primarily Flash background who had lived in the Flash IDE exclusively I found many aspects of Eclipse to be a bit daunting (the dreaded IDE learning curve), but after several months of exploration the light finally came on and I’ve gotta say Eclipse rocks! There are many reasons why I’ve totally fallen for this platform, but today I’d like to discuss ASDT editor templates (I’ll be extracting portions of the email exchange with Jesse on this topic so note the context).

Editor templates are simply code templates which can be invoked by typing in a shortcut command (i.e. “singleton” or “class”) and hitting CTRL+ SPACE on your keyboard. The are some useful default templates which are part of the ASDT plugin editor, but I’ve found that everything really needs to be modified to taste and customized to reflect user specific attributes. As I said to Jesse, “I’ve been using Flash in Eclipse for almost 2 months and I know it was not readily apparent how to use the shortcut commands, or how to edit and create new templates. Now that I’ve figured them out and begun using them, it has further cemented my love for the ASDT editor.” I also included a rather quick and dirty Captivate tutorial, found here, which detailed where to find the editor templates, how to modify existing templates, create new templates and use them in your code.

As an example, here’s template code which creates the class structure with the EventDispatcher mixin included:

 * @author Paul Brooks Andrus
 * Copyright BadAttitude Productions
 * ${date}


class ${enclosing_package_and_type} { 

     function dispatchEvent(){};
     function addEventListener(){};
     function removeEventListener(){};
     * Constructor
     function ${enclosing_type}(${cargs}) {



The nice thing about the templates is not only do they save you a ton of typing, but you can also use variables which are represented by the styntax ${variable name}.

Another thing everyone should do is look at the Java editor templates and mine them for goodies (as an example, I took the switch statement template and modified it to taste).

Eclipse is a very powerful platform with a plethora of rich features, of which I have discovered but I few–Working Sets are awesome–and I hope some of you benefit from my learning curve. If you have other insights I would love to hear about them.

6 thoughts on “Eclipse ASDT Editor Templates

  1. Is there anyway to see where eclipse defined these template variables? Can we create our own template variable in eclipse?

  2. Thank you! I was also wondering where these variables come from? Is there a list or cheatsheet somewhere?

  3. I searched high and low for rovira’s article but cannot find it. could you host/post a copy of the original?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>