blob: b2b2df3601acb86ebf12e360636e0b224d5f31d4 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Code Generation
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
</head>
<body>
<h1>
Code generation
</h1>
<p>The code generation preferences are separated in two sections:</p>
<ul>
<li>Names</li>
<li>Code and Comments</li></ul>
<h2 class="Head">Names</h2>
<p>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.<br>
Naming conventions are used by the <b>Generate Getter and Setter</b> action and by all actions and 'Quick Fix' proposals that create fields, parameters and local variables.</p>
<table border="1" cellspacing="0" cellpadding="5" width="600">
<thead>
<tr>
<th>
<p>Action</p>
</th>
<th>
<p>Description</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" width="25%">
<p><strong>Edit...</strong></p>
</td>
<td valign="top">
<p>Opens a dialog to edit the list of prefix and suffixes for the currently selected variable type</p>
</td>
</tr>
</tbody>
</table>
<h2>Code and Comments</h2>
<p>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.</p><table
border="1" cellspacing="0" cellpadding="5" width="600">
<thead>
<tr>
<th>
<p>Action</p>
</th>
<th>
<p>Description</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" width="25%">
<p><strong>Edit...</strong></p>
</td>
<td valign="top">
<p>Opens a dialog to edit the currently selected code template.</p>
</td>
</tr>
<tr>
<td valign="top">
<p><strong>Import...</strong></p>
</td>
<td valign="top">
<p>Imports code templates from the file system.</p>
</td>
</tr>
<tr>
<td valign="top">
<p><strong>Export...</strong></p>
</td>
<td valign="top">
<p>Exports all selected code templates to the file system.</p>
</td>
</tr>
<tr>
<td valign="top">
<p><strong>Export All...</strong></p>
</td>
<td valign="top">
<p>Exports all code templates to the file system.</p>
</td>
</tr>
<tr>
<td valign="top"><b>Automatically add comments for new methods and
types</b></td>
<td valign="top">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 <b>Add
Javadoc Comment</b> action). Note that this setting does not apply to comments contained in the code templates like <b>New
Java files</b></td>
</tr>
</tbody>
</table>
<h3>Comment templates</h3>
<p>Comment templates can contain the variable <b>${tags}</b> that will be substituted by the standard Javadoc tags (@param, @return..) for the commented element.
The 'Overriding method' comment can additionally contain the template <b>${see_to_overridden}</b></p><ul>
<li>Constructor comment: Template that speciyfies the comment for new constructors</li>
<li>Type comment: Template that speciyfies the comment for new types. Note that this template can be referenced in the 'New Java File' template</li>
<li>Method comment: Template that speciyfies the comment for new methods that do not override an method in a base class</li>
<li>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</li>
</ul>
<h3>New Java files template</h3>
<p>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 <b>${typecomment}</b> that will be substituted by the evaluation of the type comment template.</p>
<h3>Catch block body template</h3>
<p>The 'Catch block body' template is used when a catch block body is
created. It can use the variables <b>${exception_type}</b> and <b>${exception_var}</b>.</p>
<h3>Method body template</h3>
<p>The 'Method body' templates are used when
new method with body is created. It contains the variable
<b>${body_statement}</b> that resolves to a return statement or/and a super-call. </p>
<h3>Constructor body templates</h3>
<p>The 'Constructor body' templates are used when new method or constructor with body is
created. It contains the variable <b>${body_statement}</b> that resolves a super call.<b></b></p>
<h2>Code Template dialog</h2>
<p>The following fields and buttons appear in the dialog:</p>
<table border="1" cellspacing="0" cellpadding="5" width="100%">
<thead>
<tr>
<th>
<p>Option</p>
</th>
<th>
<p>Description</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top">
<p><strong>Description</strong></p>
</td>
<td valign="top">
<p>A description of the template</p>
</td>
</tr>
<tr>
<td valign="top">
<p><strong>Pattern</strong></p>
</td>
<td valign="top">
<p>The template pattern.</p>
</td>
</tr>
<tr>
<td valign="top">
<p><strong>Insert Variables...</strong></p>
</td>
<td valign="top">
<p>Displays a list of pre-defined template specific variables.</p>
</td>
</tr>
</tbody>
</table><p>
<img src="../images/ngrelt.gif" alt="Related tasks" border="0"
height="27" width="159"><br>
<a href="../tasks/tasks-57.htm">Generating getters and setters</a><br>
</p>
<p>
<img border="0" width="159" height="27" src="../images/ngrelr.gif" alt="Related reference"><br>
<a href="../reference/ref-menu-source.htm">Source actions</a><br>
<a href="../reference/ref-java-editor.htm">Java editor</a><br>
<a href="../reference/ref-21.htm">Java editor preferences</a><br>
<a href="../reference/ref-preferences-templates.htm">Templates preferences</a>
</p>
<p>
<a href="../hglegal2003.htm"></a><a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"
width="324" height="14"></a>
</p>
</body>
</html>