FDT templates
The day I found out that it is possible to define code snippets within the FDT plugin my productivity went up about 20%. I wasn’t actually aware of the feature until I stumbled upon it by chance so I venture there are more people out there that are missing out on this unique chance to boost their productivity. What is this all about?
FDT lets you define templates for frequently used code snippets that you can call via a key word you define.
For example: when you type “fori” and hit CTRL+Space FDT will suggest to write a regular for-loop for you and guide you from one crucial element of the loop to the other e.g. to change the suggested index or array the loop is performed on. Isn’t that great?
And it gets even better: you can create new templates and call them via the keyword you choose. Never want to write a singleton from scratch again? Here is how it goes:
Open Eclipse and choose Window -> Preferences -> FDT -> Editor -> Templates . Here you can define new templates or reconfigure the existing ones. Or you just import other peoples templates. Like mine :)
I recently created a resources page and placed a zip package of XMLs with my most frequently used code templates on it. Among an improved for-loop the package contains a complete singleton template in AS3 (using the enforcer class approach), a getter/setter combo and a for loop backwards as this (according to Colin Moock) seems to perform better than the regular forward loop. I use it whenever sequence doesn’t matter. Don’t be surprised that the loops might look a little strange since I modified them under performance aspects.
Note: the template definitions are - as much else with Eclipse plugins - workspace dependent, meaning, that you will have to set them up for each of your workspaces. You can use the export/import function to distribute the templates among your existing workspaces. However, I’d advise you to always keep a clean, fully set up workspace as a backup in case one crashes (every once in a while Eclipse gets bored with life). This will save you from setting up all of your FDT and view details over and over again. It’s enough work to set up the projects again.

