# Code generation

The code generation preferences are separated in two sections:

- Names
- Code and Comments

## Names

This page defines the naming conventions for fields (static and non-static), parameters and local variables. For each variable type it is possible to configure a list of prefix or suffix or both.
Naming conventions are used by the Generate Getter and Setter action and by all actions and 'Quick Fix' proposals that create fields, parameters and local variables.

Action | Description
--- | ---
Edit... | Opens a dialog to edit the list of prefix and suffixes for the currently selected variable type

## Code and Comments

The code and comment page contains code templates that are used by actions that generate code. Templates contain variables that are substituted when the template is applied. Some variables are available in all templates, some are specific to templates.

Action | Description
--- | ---
Edit... | Opens a dialog to edit the currently selected code template.
Import... | Imports code templates from the file system.
Export... | Exports all selected code templates to the file system.
Export All... | Exports all code templates to the file system.
Automatically add comments for new methods and types | This setting specifies if comment code templates are automatically added to all new methods. If disabled, the comment code templates are only used when comment is explicitly added (e.g. using the Add Javadoc Comment action). Note that this setting does not apply to comments contained in the code templates like New Java files

### Comment templates

Comment templates can contain the variable ${tags} that will be substituted by the standard Javadoc tags (@param, @return..) for the commented element. The 'Overriding method' comment can additionally contain the template ${see_to_overridden}

- Constructor comment: Template that speciyfies the comment for new constructors
- Type comment: Template that speciyfies the comment for new types. Note that this template can be referenced in the 'New Java File' template
- Method comment: Template that speciyfies the comment for new methods that do not override an method in a base class
- Overriding method comment: Template that speciyfies the comment for new methods that override an method in a base class. By default the comment is defined as a non-Javadoc comment (Javadoc will replace this comment with the comment of the overridden method). You can change this to a real Javadoc comment if you want

### New Java files template

The 'New Java files' template is used by the Class and Interface wizards when a new file is created. The template can specify where comments are added. Note that the template can contain the variable ${typecomment} that will be substituted by the evaluation of the type comment template.

### Catch block body template

The 'Catch block body' template is used when a catch block body is created. It can use the variables ${exception_type} and ${exception_var}.

### Method body template

The 'Method body' templates are used when new method with body is created. It contains the variable ${body_statement} that resolves to a return statement or/and a super-call.

### Constructor body templates

The 'Constructor body' templates are used when new method or constructor with body is created. It contains the variable ${body_statement} that resolves a super call.

## Code Template dialog

The following fields and buttons appear in the dialog:

Option | Description
--- | ---
Description | A description of the template
Pattern | The template pattern.
Insert Variables... | Displays a list of pre-defined template specific variables.

Generating getters and setters

Source actions
Java editor
Java editor preferences
Templates preferences