This page lets you configure the format of newly generated 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. |
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}
The 'New Java files' template is used by the New Type wizards when a new Java 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.
The 'Catch block body' template is used when a catch block body is created. It can use the variables ${exception_type} and ${exception_var}.
The 'Method body' templates are used when new method with a body is created that still needs some code to complete its functionality. It contains the variable ${body_statement} that resolves to a return statement or/and a super-call.
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.
The 'Getter body' templates are used when new getter method is created . It contains the variable ${body_statement} that resolves to the appropriate return statement.
The 'Setter body' templates are used when new setter method is created . It contains the variable ${body_statement} that resolves to the appropriate assignment statement.
The following fields and buttons appear in the dialog:
Action |
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