blob: d091c5b966652041bf103f69fa6e328f1627373f [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<title>
Code style
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
</head>
<body>
<h1>
Code style
</h1>
<p>The
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeStylePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Code Style preference page">
<b>Java &gt; Code Style</b></a> preference page
allows to configure naming conventions, style rules and comment settings.
These preferences are used when new code has to be generated.
</p>
<h2 class="Head">Naming Conventions</h2>
<p>The list 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 all actions and 'Quick Fix' proposals that create fields, parameters and local variables, in particular the <a href="../reference/ref-menu-source.htm">Source actions</a>.</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>Edit...</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 class="Head">Code Conventions</h2>
<p>The following settings specify how newly generated code should look like. The names of getter methods can be specified as well as the format of field accesses, method comments, annotations and exception variables.</p>
<table border="1" cellspacing="0" cellpadding="5" width="600">
<thead>
<tr>
<th>
<p>Action</p>
</th>
<th>
<p>Description</p>
</th>
<th>
<p>Default</p>
</th>
</tr>
</thead>
<tbody>
<tr>
<td valign="top" width="25%">
<p>Qualify all generated field accesses with 'this.'</p>
</td>
<td valign="top">
<p>If selected, field accesses are always prefixed with 'this', regardless whether the name of the field is unique in the scope of the field access or not.</p>
</td>
<td valign="top">
<p>Off</p>
</td>
</tr>
<tr>
<td valign="top" width="25%">
<p>Use 'is' prefix for getters that return boolean</p>
</td>
<td valign="top">
<p>If selected, the names of getter methods of boolean type are prefixed with 'is' rather than 'get'.</p>
</td>
<td valign="top">
<p>On</p>
</td>
</tr>
<tr>
<td valign="top" width="25%">
<p>Automatically add comments for new methods and types</p>
</td>
<td valign="top">
<p>If selected, newly generated methods and types are automatically generated with comments where appropriate. See the
<a href="../reference/ref-preferences-code-templates.htm">Code templates preference page</a> to specify the format of the generated comments.</p>
</td>
<td valign="top">
<p>Off</p>
</td>
</tr>
<tr>
<td valign="top" width="25%">
<p>Add '@Override' annotation for overriding methods</p>
</td>
<td valign="top">
<p>If selected, methods which override an already implemented method are annotated with an '@Override' annotation. See the
<a href="../reference/ref-preferences-compiler.htm">Compiler preference page</a> for settings related to annotations.</p>
</td>
<td valign="top">
<p>On</p>
</td>
</tr>
<tr>
<td valign="top" width="25%">
<p>Exception variable name in catch blocks</p>
</td>
<td valign="top">
<p>Specify the name of the exception variable declared in catch blocks.</p>
</td>
<td valign="top">
<p>e</p>
</td>
</tr>
</tbody>
</table>
<p>
<img border="0" src="../images/ngrelr.png" alt="Related reference"></p>
<p>
<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-compiler.htm">Java compiler preferences</a><br>
<a href="../reference/ref-preferences-code-templates.htm">Code templates preferences</a>
</p>
</body>
</html>