IntelliJ IDEA 11.0 Web Help

File | Settings | IDE Settings | File Templates

Ctrl+Alt+SMeta Comma

settings

IntelliJ IDEA | Preferences | IDE Settings | File Templates

Ctrl+Alt+SMeta Comma

settings

Use this page to view, edit, create, and remove file templates.

The toolbar buttons and other controls are common for all the tabs of the page.

Toolbar

Item Tooltip Description
add Create Template Click this button to create a new template in the currently opened tab. The button is available in the Templates and Includes tabs.
delete Remove Template Click this button to delete the selected template. The button is available in the Templates and Includes tabs.
copy Copy Template Click this button to create a copy of the selected template. The button is available in the Templates and Includes tabs.
resetProfileToDefault Reset to Default Click this button to abandon all the changes made to the selected template and restore its default state. The button is available only for modified templates.

Tip

The names of the modified templates are displayed in blue.

Controls

Item Description
Name In this text box, specify the name of the selected template.
Extension In this text box, specify the extension for IntelliJ IDEA to detect files, where the selected template should be applied during creation.
Reformat according to style Select this check box, to have IntelliJ IDEA reformat generated stub files according to the style defined in the Code Style dialog box.
Template text In this text box, specify the body of the template:
  • Plain text.
  • #parse directives to work with template includes.
  • Variables to be expanded into corresponding values in the format ${<variable_name>}.

    The available predefined file template variables are:

    • ${PACKAGE_NAME} - the name of the target package where the new class or interface will be created.
    • ${USER} - login name of the current user.
    • ${NAME} - the name of the file that will be created.
    • ${DATE} - the current system date.
    • ${TIME} - the current system time.
    • ${YEAR} - the current year.
    • ${MONTH} - the current month.
    • ${DAY} - the current day of the month.
    • ${HOUR} - the current hour.
    • ${MINUTE} - the current minute.

    Tip

    To include some Velocity variable in your template that you don't want to be expanded by IntelliJ IDEA on template applying, prepend it with the '\' character.

    For example, to use some version control keywords (such as $Revision$, $Date$, etc.) in your default class template, you need to prepend them with a '\': \$Revision$.

  • Custom variables. Their names will be defined during the file creation.
Description In this text box, provide some information about the template, its predefined variables, and the way they work.

Tabs

Tab Description
Templates The tab displays the available file templates. More file templates can be found on the Java EE tab.
Includes The tab shows the templates of reusable fragments that may be included in the file templates.
Code The tab displays built-in snippets, that is, templates for code fragments that IntelliJ IDEA may generate in various typical situations.

You can edit the existing snippets but you cannot create new ones.

For any snippet that you have modified, the Reset button (link) is available in the upper right corner of the page which you can use to restore the initial state of the snippet.

Java EE The tab displays groups of Java EE-related and other templates.

The templates on this tab can be edited but cannot be removed. Creating new templates on this tab is not allowed.

To restore the initial state of any of the modified templates, use the Reset button (link) in the upper right corner of the page.

See Also

Concepts:

Procedures:

Web Resources: