Search code examples
eclipsecode-templates

How do you set up new class templates in Eclipse?


I mainly program Android, and one of the things I (and the rest of android programmers I'm sure) use with tenacity is android.util.Log. Every class I create has a

private static final String TAG = "ClassName";

tag that I write up as soon as I create the class, before I work on anything else. So, since I always create the tag I figured it would just save me on time (albeit a small amount) to just have it as part of the template for an empty class. My problem is, I don't know how or where to create code templates. Can anyone inform me on how to manage and create them?


Solution

  • What you're referring to are called "code templates" in Eclipse.

    Go to Eclipse Preferences, search for "templates", you'll find them under Java -> Code Style -> Code Templates.