blob: dfda3a255c8f5dc4d8a0c44cb22b746fb21d9172 [file] [log] [blame]
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en">
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2017. 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-Language" content="en-us">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="STYLESHEET" href="../book.css" charset="ISO-8859-1" type="text/css">
<style type="text/css">
ul {padding-left: 1.2em; margin-left: 1.2em;}
</style>
<title>Tips and Tricks (JDT)</title>
<script language="JavaScript" type="text/javascript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
</head>
<body>
<h2>Tips and Tricks (JDT)</h2>
<p>
The following tips and tricks give some helpful ideas for increasing your productivity.
See also <a href="../../org.eclipse.platform.doc.user/tips/platform_tips.html">Platform Tips and Tricks</a>
for general Eclipse tips and <a href="../../org.eclipse.jdt.doc.user/whatsNew/jdt_whatsnew.html">What's New (JDT)</a> for
features in this release.
</p>
<br>
<p>
<a href="#editing_section">Editing</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#refactor_section">Refactoring</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#searching_section">Searching</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#navigation_section">Navigation</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#views_section">Views</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#misc_section">Miscellaneous</a> &nbsp;&nbsp;|&nbsp;&nbsp;
<a href="#debugging_section">Debugging</a>
</p>
<br>
<h3><a name="editing_section"></a>Editing source</h3>
<table border="1" cellpadding="10" cellspacing="0" summary="Editing source tips and tricks">
<tbody>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist</b></td>
<td valign="top" align="left" width="80%">Content assist provides you
with a list of suggested completions for partially entered strings.
In the Java editor press <b>Ctrl+Space</b> or use <b>Edit &gt;
Content Assist</b>.
<p><img src="images/code-assist.png" border="0" alt="Content assist selection dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist in
Javadoc comments</b></td>
<td valign="top" align="left" width="80%">Content assist is also
available in Javadoc comments.
<p><img src="images/code-assist-javadoc2.png" border="0" alt="Content assist for Javadoc comments"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist for static imports</b></td>
<td valign="top" align="left" width="80%">To get content assist proposals for static members
configure your list of favorite static members on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferenceFavorites)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Favorites preference page">
<b>Java &gt; Editor &gt; Content Assist &gt; Favorites</b></a> preference page.
<p>For example, if you have added <code>java.util.Arrays.*</code> to
this list, then all static methods of this type matching the completion
prefix will be added to the proposals list:</p>
<p><img src="images/content-assist-proposals.png" alt="Content Assist proposals"></p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Suppress types in content
assist</b></td>
<td valign="top" align="left" width="80%">
To exclude certain types from appearing in content assist, use the type
filter feature configured on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.TypeFilterPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the type filter preference page">
<b>Java &gt; Appearance &gt; Type Filters</b></a>
preference page. Types matching one of these filter patterns
will not appear in the Open Type dialog and will not be available to
content assist, quick fix and organize imports. These filter patterns
do not affect the Package Explorer and Type Hierarchy views.
<p><img border="0" src="images/type-filter.png" alt="Type filter preference page"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist for
variable, method parameter and field name completions</b></td>
<td valign="top" align="left" width="80%">
You can use content assist to speed up the creation of fields, method
parameters and local variables. With the cursor positioned after the
type name of the declaration, press <b>Ctrl+Space</b> or use <b>Edit &gt; Content Assist</b>.
<p><img src="images/code-assist-fieldname.png" alt="Suggestions for field names"></p>
<p>If you use a name prefix or suffix for fields, local variables or
method parameters, be sure to specify this in 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.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist for variable with unresolved type</b>
</td>
<td valign="top" align="left" width="80%">Code assist also works on accesses to
types that are not imported yet. Depending on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Content Assist preference page">
<b>Java &gt; Editor &gt; Content Assist </b></a>
<b>&gt; Add import instead of qualified name</b> preference the editor
will either automatically add imports or fully qualify the types for such
proposals.
<p>Pressing <b>;</b> in the following scenario:</p>
<p>
<img title="Content Assist For Variables With Unresolved Types" alt="Screenshot showing Content Assist for variables with unresolved types" src="images/code-assist-with-import.png">
</p>
<p>results in:</p>
<p>
<img title="Content Assist Result When Pressing ';'" alt="Screenshot showing the content assist result when pressing ';'" src="images/code-assist-with-import-result.png">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist after instanceof condition</b></td>
<td valign="top" align="left" width="80%">Content assist can propose members
available on types used in instanceof conditions.
<p>
<img title="Content Assist After instanceof Condition" alt="Screenshot showing Content Assist after instanceof condition" src="images/instanceof-compl-proposals.png">
</p>
<p>
Eclipse will add the required cast for you when you select such a proposal.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Parameter hints</b></td>
<td valign="top" align="left" width="80%">With the cursor in a method
argument, you can see a list of parameter hints. In the Java Editor
press <b>Ctrl+Shift+Space</b> or invoke <b>Edit &gt; Content Assist &gt; Parameter Hints</b>.
<p><img src="images/parameter-hints.png" border="0" alt="Parameter hint hover"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist on
anonymous classes</b></td>
<td valign="top" align="left" width="80%">Content assist also
provides help when creating an anonymous class. With the cursor
positioned after "new " and the beginning of an abstract class or interface name
press <b>Ctrl+Space</b> or invoke <b>Edit &gt; Content Assist &gt; Default</b>.
<p><img src="images/code-assist-anonym1.png" border="0" alt="Content assist for an anonymous class"></p>
This will create the body of the anonymous inner class including all
methods that need to be implemented.
<p>This also works if you place the caret after the opening parentheses of a class instance creation:</p>
<p><img src="images/code-assist-anonym2.png" border="0" alt="Content assist for an anonymous class"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Toggle between
inserting and replacing content assist</b></td>
<td valign="top" align="left" width="80%">When content assist is invoked
on an existing identifier, it can either replace the
identifier with the chosen completion or do an insert. The
default behavior (overwrite or insert) is defined in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the content assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page.<br>
You can temporarily toggle the behavior while inside the content
assist selection dialog by pressing and holding the <b>Ctrl</b> key while
selecting the completion.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Incremental content assist</b></td>
<td valign="top" align="left" width="80%">Content assist can also <b>Insert common prefixes automatically</b>, similar to
Unix shell expansion. To enable that behavior, select the check box on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the content assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Camel case support in code completion</b>
</td>
<td valign="top" align="left" width="80%">Code completion supports camel case patterns.
For example, completing on <tt>NPE</tt> or <tt>NuPoiE</tt> will propose <tt>NullPointerException</tt>.
This support can be disabled using the <b>Show camel case matches</b>
preference on the <a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Content Assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page.
<p><img alt="Java editor completing on NPE" src="images/completiononcamelcase.png">
</p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Substring code completion</b>
</td>
<td valign="top" align="left" width="80%">
Content Assist supports substring patterns. Enter any part of the desired proposal's text, and Content Assist will find it!
For example, completing on <code>selection</code> proposes all results containing <code>selection</code> as a substring.
<p>
<img src="images/substring-code-completion.png" alt="Popup with proposals like addSelectionListener(..), getSelection(), etc.">
</p>
<p>
This feature can be disabled using the <b>Show substring matches</b> option on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Content Assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use ';' key to insert method invocation</b>
</td>
<td valign="top" align="left" width="80%">
You can use the semicolon (<b>;</b>) key to select any method invocation proposal from the content assist popup.
The '<code>;</code>' will be appended at the end of the method invocation.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Customize content assist categories</b>
</td>
<td valign="top" align="left" width="80%">
Repeatedly invoking content assist <b>(Ctrl+Space)</b> cycles through different proposal
categories.
<p>
<img src="images/content_assist_participant.png" border="0" alt="Content assist with new method template proposals">
</p>
To configure which categories to show use the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferenceAdvanced)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the content assist preference page">
<b>Java &gt; Editor &gt; Content Assist &gt; Advanced</b></a> preference page.
<p>
You can also assign separate key shortcuts to your favorite proposal categories.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create getters and
setters</b></td>
<td valign="top" align="left" width="80%">To create getter and setter
methods for a field, select the field's declaration and invoke <b>Source
&gt; Generate Getter and Setter</b>.
<p><img src="images/create-getter-setter.png" border="0" alt="Generate Getter and Setter dialog">
</p>
If you use a name prefix or suffix be sure to specify this in 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.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create getters and setters quick assist</b></td>
<td valign="top" align="left" width="80%">A quick assist <b>(Ctrl+1)</b> is available on fields to
create getters and setters.
<p>
<img title="Create Getters and Setters Quick Assist" alt="Screen shot showing the create getters and setters quick assist" src="images/gettersetter-quickassist.png">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use content assist to
create getter and setters</b></td>
<td valign="top" align="left" width="80%">Another way to create
getters and setters is using content assist. Set the cursor in the
type body between members and press <b>Ctrl+Space</b> to get the proposals
that create a getter or setter method stub. <br>
<img border="0" src="images/codeassist-getter.png" alt="Content assist for creating a setter"></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Delete getters and
setters together with a field</b></td>
<td valign="top" align="left" width="80%">When you delete a field
from within a view,
Eclipse can propose deleting its Getter and Setter methods.
If you use a name prefix or suffix for fields, be sure to specify this in 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.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create delegate methods</b></td>
<td valign="top" align="left" width="80%">To create a delegate method
for a field select the field's declaration and invoke <b>Source &gt;
Generate Delegate Methods</b>. This adds the selected methods
to the type that contains a forward call to delegated methods. This
is an example of a delegate method: <br>
<img src="images/delegate-method.png" border="0" alt="Delegate method example">
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create <code>hashCode()</code> and <code>equals()</code></b>
</td>
<td valign="top" align="left" width="80%">To create the methods <code>hashCode()</code> and <code>equals()</code>
invoke <b>Source &gt; Generate hashCode() and equals()</b>.
<p>
<img src="images/create-hashcode-equals.png" border="0" alt="Generate hashCode() and equals() dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use templates to create
a method</b></td>
<td valign="top" align="left" width="80%">Templates are shown together with the <b>Content
Assist (Ctrl+Space)</b> proposals.<br>
There are existing templates, such as 'private_method',
'public_method', 'protected_method' and more, but you can also
define new templates for method stubs.<br>
<p>After applying a template, use the <b>Tab</b> key to navigate among the values to enter
(return type, name and arguments).<br>
<img src="images/templates-create-method.png" border="0" alt="Content assist with new method template proposals">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use templates to create
SWT widgets</b></td>
<td valign="top" align="left" width="80%">On projects which have the SWT library on the classpath,
you can create SWT widgets with <b>Content Assist (Ctrl+Space)</b>
<p>To add, for example, an SWT button, type <i>Button</i> and press <strong>Ctrl+Space</strong>,
select the <i>Button</i> SWT template, and press <strong>Enter</strong>.</p>
<p> <img src="images/swt-templates.png" alt="Create a button with the Button template"> </p>
<p>To see all available templates go to the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Templates preference page">
<b>Java &gt; Editor &gt; Templates</b></a> preference page or open the Templates view through <b>Window &gt; Show View &gt; Other...</b>.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create your own
templates</b></td>
<td width="80%" valign="top">
To create your own templates, go to the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the editor templates preference page">
<b>Java &gt; Editor &gt; Templates</b></a> preference page and press the <b>New</b> button to
create a template. For example, a template to iterate backwards in an
array would look like this:
<p>
<img src="images/template-for-iter.png" alt="Template for an iterator"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use Quick Fix to create
a new method</b></td>
<td valign="top" align="left" width="80%">Start with the method
invocation and use <b>Quick Fix (Ctrl+1)</b> to create the method.
<p><img src="images/quick-fix-create-method.png" border="0" alt="'Create method' quick fix">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use Quick Fix to change
a method signature</b></td>
<td valign="top" align="left" width="80%">Add an argument to a method
invocation at a call site. Then use <b>Quick Fix (Ctrl+1)</b> to add the
required parameter in the method declaration.
<p><img src="images/quickfix-change-signature.png" border="0" alt="'Change signature' quick fix">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use content assist to
create a constructor stub</b></td>
<td valign="top" align="left" width="80%">At the location where you
want to add the new constructor, use content assist after typing the
first letters of the constructor name.<br>
<img border="0" src="images/code-assist-add-constructor.png" alt="Create constructor with content assist"></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create new fields from
parameters</b></td>
<td valign="top" align="left" width="80%">Do you need to create new
fields to store the arguments passed in the constructor or method? Use <b>Quick
Assist</b> (<b>Ctrl+1</b>) on a parameter to create the assignment and the
field declaration and let Eclipse propose a name according to your Code
Style preferences.<br>
<img border="0" src="images/quick-assist-create-field.png" alt="'Assign parameter to new field' quick assist"></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use content assist to
override a method</b></td>
<td valign="top" align="left" width="80%">Invoke <b>Content Assist
(Ctrl+Space)</b> in the type body at the location where the method
should be added. Content assist will offer all methods that can be
overridden. A method body for the chosen method will be created.
<p><img src="images/code-assist-newmethod.png" border="0" alt="'Override method' content assist">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use Quick Fix to add
unimplemented methods</b></td>
<td valign="top" align="left" width="80%">To implement a new
interface, add the 'implements' declaration first to the type.
Even without saving or building, the Java editor will underline the
type to signal that methods are missing and will show the Quick Fix
light bulb. Click on the light bulb or press <b>Ctrl+1 (Edit &gt;
Quick Fix)</b> to choose between adding the unimplemented methods or
making your class abstract.
<p><img src="images/quick-fix-unimplemented-methods.png" border="0" alt="Quick Fix offering 'Add unimplemented methods' proposal">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use Clean Up to add
unimplemented methods</b></td>
<td valign="top" align="left" width="80%">When you add a new method to
an interface or an abstract method to an abstract class, Eclipse can generate
method stubs in all concrete subclasses at once. Invoke <b>Source &gt; Clean Up...</b>
on a set of Java elements, use a custom profile, and select on the <b>Configure...</b>
dialog to <b>Add unimplemented methods</b> on the <b>Missing Code</b> tab.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Override a method
from a base class</b></td>
<td valign="top" align="left" width="80%">To create a method that
overrides a method from a base class: <br>
Select the type where the methods should be added and invoke <b>Source &gt;
Override/Implement Methods</b>. This opens a dialog that lets you
choose which methods to override.
<p><img src="images/override-method.png" border="0" alt="'Override/Implement method' dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Rename in file</b></td><td valign="top" align="left" width="80%">To quickly do a rename that
doesn't require full analysis of dependencies in other files, use the
'Rename in file' Quick Assist. In the Java Editor, position the
cursor in an identifier of a variable, method or type and press <b>Ctrl+1
(Edit &gt; Quick Fix)</b><br>
The editor is switched to the linked edit mode (like templates) and
changing the identifier simultaneously changes all other references
to that variable, method or type.
<p><img src="images/quick-fix-localrename.png" border="0" alt="Changing multiple identifiers using 'Local Rename' quick fix">
</p>
You can also use the direct shortcut <b>Ctrl+2 R</b>. Use the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens keys preference page">
<b>General &gt; Keys</b></a> preference page
to configure shortcuts (in the 'Source' category).
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Rename in workspace</b></td><td valign="top" align="left" width="80%">
The <b>Refactor &gt; Rename</b> (<b>Alt+Shift+R</b>) popup has an <b>Options...</b> link which opens the full <b>Rename dialog</b> that
provides more options like renaming a field's getter and setter methods.
<p>
<img src="images/rename-options.png" alt="">
</p>
The dialog can also be opened via the menu button in the popup or by pressing <b>Alt+Shift+R</b> again.
The in-place mode can be disabled entirely via the <b>Rename in editor without dialog</b> option on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaBasePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Java preference page">
<b>Java</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use Quick Fix to handle
exceptions</b></td>
<td width="80%" valign="top">Dealing with thrown exceptions is
easy. Unhandled exceptions are detected while typing and marked with
a red line in the editor.
<ul>
<li>Click on the light bulb or press <b>Ctrl+1</b> to surround the
call with a try catch block. If you want to include more statements
in the try block, select the statements and use <b>Source &gt;
Surround With &gt; Try/catch Block</b>. You can also select individual
statements by using <b>Edit &gt; Expand Selection To</b> and
selecting <b>Enclosing</b>, <b>Next</b> or <b>Previous</b>.</li>
<li>If the call is already surrounded with a try block, Quick Fix
will suggest adding the catch block to the existing block.</li>
<li>If you don't want to handle the exception, let Quick Fix add a
new thrown exception to the enclosing method declaration</li>
</ul>
<p><img src="images/quick-fix-uncaught-exception.png" border="0" alt="'Uncaught exception' quick fix proposals">
</p>
At any time, you can convert a catch block to a thrown exception. Use
<b>Ctrl+1 (Edit &gt; Quick Fix)</b> on a catch block.<br>
<p><img src="images/quick-assist-catch-to-throws.png" border="0" alt="'Replace catch clause with throws' quick assist">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Less typing for
assignments</b></td>
<td width="80%" valign="top">Instead of typing an assignment, start
with the expression that will be assigned.
<p><img src="images/quick-assist-assign-statement.png" border="0" alt="'Assign statement to local variable' quick assist">
</p>
Now use <b>Ctrl+1 (Edit &gt; Quick Fix)</b> and choose '<b>Assign
statement to new local variable</b>' and Quick Assist will guess a
variable name for you. <br>
<img src="images/quick-assist-assign-statement2.png" alt="Quick Assist Assignment" border="0"></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Less work with cast
expressions</b></td>
<td width="80%" valign="top">Don't spend too much time with typing casts. Ignore them first and use quick assist to add them after
finishing the statement.
<p>
For example on assignments:<br>
<img border="0" src="images/quickfix-addcast1.png" alt="Add cast in assignment"> <br>
Or for method arguments:<br>
<img border="0" src="images/quickfix-addcast2.png" alt="Add cast for method arguments"> <br>
Or for method call targets:<br>
<img border="0" src="images/quickfix-addcast3.png" alt="Add cast in method call targets"></p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Assign a cast expression</b><br>
</td>
<td width="80%" valign="top">After an 'instanceof' check, it is very common to cast the expression and assign it to a new local variable. Invoke <b>Quick
Assist (Ctrl+1)</b> on the 'instanceof' keyword or at the beginning of the block body to save yourself some typing:<br>
<img border="0" src="images/assign-to-casted-quickfix.png"
alt="'Introduce new local with casted type' quick fix">
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Surround lines</b></td>
<td width="80%" valign="top">To surround statements with an if /
while / for statement or a block, select the lines to surround and
invoke <b>Source &gt; Surround With</b> or press <b>Alt+Shift+Z</b>.
<p><img src="images/surroundwith.png" border="0" alt="'Surround with templates' quick assist">
</p>
<p>The entries in the menu are derived from the normal editor templates: All
templates that contain the variable ${line_selection} will show up in the menu.</p>
Templates can be configured on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the editor templates preference page">
<b>Java &gt; Editor &gt; Templates</b></a> preference page. Edit the corresponding templates to customize the resulting code or
define your own surround-with templates.<br>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create 'for' loops</b></td>
<td width="80%" valign="top">A set of <b>Quick Assists (Ctrl+1)</b> can create <code>for</code> loops that iterate over a given expression.
<p>
For arrays:
</p>
<ul>
<li>Create an enhanced <code>for</code> loop</li>
<li>Create a <code>for</code> loop using an index</li>
</ul>
<p><a href="images/quickfix-create-for-loop-array.txt"><img src="images/quickfix-create-for-loop-array.png" alt=""></a></p>
For <code>Collection</code>s:
<ul>
<li>Create an enhanced <code>for</code> loop</li>
<li>Create a <code>for</code> loop using an <code>Iterator</code></li>
</ul>
For <code>List</code>s:
<ul>
<li>Create a <code>for</code> loop using an index and <code>get(i)</code></li>
</ul>
<p><a href="images/quickfix-create-for-loop-collection.txt"><img src="images/quickfix-create-for-loop-collection.png" alt=""></a></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Migrate anonymous class creations to lambda expressions and back</b></td>
<td width="80%" valign="top">You can convert anonymous class creations to lambda expressions (and back) by invoking the <b>Quick Assists (Ctrl+1)</b>:
<ul>
<li>Convert to lambda expression</li>
<li>Convert to anonymous class creation</li>
</ul>
<p>Before:</p>
<p><img src="images/convert-to-lambda-1.png" alt="anonymous class with a 1-line method body"></p>
<p>After the Quick Assist (<b>Ctrl+1</b>), the 6 lines are condensed into 1:</p>
<p><img src="images/convert-to-lambda-2.png" alt="lambda expression -- everything on 1 line"></p>
Or invoke <b>Source &gt; Clean Up...</b>, use a custom profile, and on the <b>Configure...</b> dialog select <b>Convert functional interface instances</b>
and <b>Use lambda where possible</b> on the <b>Code Style</b> tab.
<p>The Clean Up will not convert a functional anonymous class to lambda if the method has declaration annotations (other than <code>@Override</code> and <code>
@Deprecated</code>). You can still use the quick assist to do the conversion in such cases.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Migrate lambda expressions to method references and back</b></td>
<td width="80%" valign="top">You can convert lambda expressions to method references (and back) by invoking the <b>Quick Assists (Ctrl+1)</b>:
<ul>
<li>Convert to method reference
<p><img src="images/convert-to-method-reference.png" alt="t -> Integer.toHexString(t)"></p></li>
<li>Convert to lambda expression
<p><img src="images/convert-to-lambda.png" alt="Integer::toHexString"></p></li>
</ul>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>More Quick Assists and Fixes</b><br>
</td>
<td width="80%" valign="top">Check out the <a
href="../reference/ref-java-editor-quickassist.htm">Quick Assist</a> page for a complete list of available code transformations. A list of quick fixes can be found <a
href="../reference/ref-java-editor-quickfix.htm">here</a>.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Shortcuts for Quick Fixes and Assists<br>
</b></td>
<td valign="top" align="left" width="80%">Some of the popular quick assists like
<b>Rename in file</b> and <b>Assign to local variable</b> can be invoked
directly with <b>Ctrl+2&nbsp;R</b> and <b>Ctrl+2&nbsp;L</b>. Check
the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Keys)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens keys preference page">
<b>General &gt; Keys</b></a> preference page for more quick fixes and quick assists that support direct
invocation.
<p>Type "Quick Assist" or "Quick Fix" in the filter field:</p>
<p><img src="images/quick-assist-shortcuts.png" alt="Keys preference page with quick assist shortcuts"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Annotate command</b></td>
<td width="80%" valign="top">You can invoke <b>Annotate</b> command - either by using the context menu, or by pressing <b>Ctrl+1</b> - when browsing attached source code of a library
using the class file editor to annotate any type in the signature of a library method or field. Proposals will be offered for marking the selected type as <code>@NonNull</code> or <code>@Nullable</code>.
After selecting a proposal, the compiler will immediately leverage the new annotation for its null analysis.
<p><img src="images/annotate-map-return.png" alt=""></p>
<p>Two pre-requisites must be met for using this command:</p>
<ul>
<li>The project is configured to use annotation-based null analysis.</li>
<li>An existing workspace folder has been specified as the external annotation location for a given library.</li>
</ul>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Content assist can insert
argument names automatically</b></td>
<td width="80%" valign="top">
You can have content assist insert argument names automatically on
method completion. This behavior can be customized on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the content assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page (see the
<b>Fill method arguments and show guessed arguments</b> checkbox.) For example, when
you select the second entry here,
<p><img src="images/code-assist-argument-proposal.png" alt="content assist window">
</p>
<p>content assist will automatically insert argument names:</p>
<p><img src="images/code-assist-argument-proposal-inserted.png" alt="content assist inserted argument names">
</p>
<p>You can then use the <b>Tab</b> key to navigate between the
inserted names.</p>
<p>If you choose <b>Insert best guessed arguments</b>, the best guess will be filled in by default. The alternative
proposals are still available.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Automatically insert
type arguments</b><br>
</td>
<td width="80%" valign="top">Enabling <b>Fill method arguments and show guessed arguments</b> on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeAssistPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the content assist preference page">
<b>Java &gt; Editor &gt; Content Assist</b></a> preference page
is also useful when working with parameterized types in J2SE 5.0.<br>
<img border="0" src="images/code-assist-type-arg-guessing.png"
alt="Content assist on a parameterized type">
<br>results in:<br>
<img border="0" src="images/code-assist-type-arg-guessing2.png"
alt="Content assist guessed and inserted type argument">
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Remove type arguments after content assist</b><br>
</td>
<td width="80%" valign="top">
If content assist added type arguments for a generic type, but you do not want them
because you need the <code>.class</code> literal or you want to invoke a static method,
rather than deleting all the arguments manually,
you can just delete the '<code>&lt;</code>' and that will remove the entire text up to '<code>&gt;</code>'.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Remove surrounding
statement</b></td>
<td width="80%" valign="top">To remove a surrounding statement or
block, position the cursor at the opening or closing bracket and press <b>Ctrl+1
(Edit &gt; Quick Fix)</b>.
<p><img src="images/quick-assist-remove-surrounding.png" border="0" alt="'Remove surrounding statement' quick assist">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>How was that word spelled again?</b></td>
<td>You can enable spell-checking support in the Java editor on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.editors.preferencePages.Spelling)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the spelling preference page">
<b>General &gt; Editors &gt; Text Editors &gt; Spelling</b></a>
preference page. Spelling errors
are displayed in the Java editor and corresponding Quick Fixes are available:
<p><img alt="An example of a spelling correction proposal." title="Spelling Correction Proposal" src="images/spelling-correction-proposal.png" align="middle"></p>
<p>You can make the
dictionary also available to the content assist. A Quick Fix allows you to
add new words to the user dictionary on the fly.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Structured selections</b></td>
<td width="80%" valign="top">The Structured Selection actions can be used to
enlarge the current selection to the next enclosing element:
<p>Highlight some text and press <b>Alt+Shift+Arrow Up</b> or select <b>Edit
&gt; Expand Selection To &gt; Enclosing Element</b> from the menu
bar - the selection will be expanded to the smallest Java-syntax
element that contains the selection. You can then further expand the
selection by invoking the action again (or other actions from the Expand Selection To menu).</p>
<p>This is for example helpful to select the enclosing identifier for renames,
or to select adjacent statements for a subsequent Extract Method refactoring.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Find the matching
bracket</b></td>
<td width="80%" valign="top">To find a matching bracket select an
opening or closing bracket and press <b>Ctrl+Shift+P</b> or select <b>Navigate &gt;
Go To &gt; Matching Bracket</b>. You can also <b>double click</b>
next to a bracket - this selects the text between the two brackets.
<p><img src="images/matching-brackets.png" border="0" alt="Using 'double click' to select text between two brackets"></p>
<p>The Java editor also supports highlighting of enclosing brackets.</p>
<p><img src="images/enclosing-brackets.png" alt="Enclosing brackets"></p>
<p>This can be configured on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaEditorPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Java editor preference page">
<b>Java &gt; Editor</b></a> preference page.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Smart Javadoc</b></td>
<td width="80%" valign="top">Type '/**' and press <b>Enter</b>. This
automatically adds a Javadoc comment stub containing the standard
@param, @return and @exception tags.
<p><img src="images/smart-javadoc.png" border="0" alt="Result of 'Smart Javadoc'">
</p>
The templates for the new comment can be configured in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the code templates preference page">
<b>Java &gt; Code Style &gt; Code Templates</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use the local history
to revert back to a previous edition of a method</b></td>
<td valign="top" align="left" width="80%">Whenever you edit a file,
its previous contents are kept in the local history. Java tooling
makes the local history available for Java elements, so you can
revert back to a previous edition of a single method instead of the
full file.
<p>Select an element (e.g. in the Outline view) and use <b>Replace With &gt; Local History</b>
to revert back to a previous edition of the element.</p>
<p><img src="images/localhistory-replace.png" border="0" alt="Replace form local history dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use the local history
to restore removed methods</b></td>
<td valign="top" align="left" width="80%">Whenever you edit a file,
its previous contents are kept in the local history. Java tooling
makes the local history available for Java elements, so you can
restore deleted methods selectively.
<p>Select a container (e.g. in the Outline view) and use <b>Restore from Local History</b> to
restore any removed members.</p>
<p><img src="images/localhistory-restore.png" border="0" alt="Restore from local history dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Customizable code
generation</b></td>
<td width="80%" valign="top" align="left">The
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the code templates preference page">
<b>Java &gt; Code Style &gt; Code Templates</b></a> preference page
allows you to customize
generated code and comments in a similar way to normal templates.
These code templates are used whenever code is generated.<br>
<p><img
src="images/code-templates.png" border="0"
alt="Code templates preference page">
</p>
Since 3.1, it is possible to use project specific Code templates, that will also be shared in the team if your project is shared. Open the <b>Properties</b> on a project to enable project specific settings.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Create comments in your
code</b></td>
<td width="80%" valign="top" align="left">Comments can be added explicitly with <b>Source &gt; Generate Element Comment (Alt+Shift+J)</b> or automatically by various wizards, refactorings or quick fixes.<br>
Configure the comment templates on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the code templates preference page">
<b>Java &gt; Code Style &gt; Code Templates</b></a> preference page.<br>
Enable or disable the automatic generation of comments either directly on the wizard (e.g. using <b>'Generate
Comment'</b> checkbox on the new Java type wizards) or by the <b>'Automatically
add new comments for new methods and types'</b> checkbox of the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.CodeTemplatePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the code templates preference page">
<b>Java &gt; Code Style &gt; Code Templates</b></a> preference page.<br>
All these settings can also be configured on a per project basis. Open the <b>Properties</b> on a project to enable project specific settings.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Sort members</b></td>
<td width="80%" valign="top" align="left">You can <b>Sort Members</b>
of a Java compilation unit or a set of compilation units according to a category order defined in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.MembersOrderPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the member sort order preference page">
<b>Java &gt; Appearance &gt; Members Sort Order</b></a> preference page.<br>
You'll find the action under <b>Source &gt; Sort Members</b>.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Wrap strings</b></td>
<td width="80%" valign="top" align="left">
You can have String literals wrapped when you edit them. For
example, if you have code like this:
<pre>String message= &quot;This is a very long message.&quot;;</pre>
<p>position your caret after the word &quot;very&quot; and press <b>Enter</b>.
The code will be automatically changed to:</p>
<pre>String message= &quot;This is a very&quot; +
&quot; long message.&quot;;</pre>
<p>This behavior can be customized in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.SmartTypingPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the typing preference page">
<b>Java &gt; Editor &gt; Typing</b></a> preference page.</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Smart Typing and how to control it</b></td>
<td>
The Java editor's Smart Typing features ease your daily work. You can configure
them on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.SmartTypingPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the typing preference page">
<b>Java &gt; Editor &gt; Typing</b></a> preference page.
<p>
<img src="images/typing-preferences.png" border="0" alt="Java editor typing preference page" title="Typing Preference Page" align="middle">
</p>
<p>
When you enable <b>Automatically insert Semicolons at correct
position</b>, typing a semicolon automatically positions the cursor at the end of the statement before inserting the semicolon. This saves you some additional cursor navigation.<br>
You can
undo this automatic positioning by pressing backspace right afterwards.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Fix your code
indentation with one key stroke</b></td>
<td width="80%" valign="top" align="left">A useful feature is <b>Source
&gt; Correct Indentation</b> or <b>Ctrl+I</b>.<br>
Select the code where the indents are incorrect and invoke the action.
<p>If nothing is selected, the action indents the current line.</p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Fix your code
indentation on save</b></td>
<td width="80%" valign="top" align="left">Eclipse can correct the indentation
of your code when you save the editor. Go to the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.SaveParticipantPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Save Actions preference page">
<b>Java &gt; Editor &gt; Save Actions</b></a> preference page and
<b>Configure...</b> <b>Additional actions</b>, and select to <b>Correct indentation</b> on
the <b>Code Organizing</b> tab.
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Quick menus for source and
refactoring actions</b></td>
<td align="left" valign="top">
The refactoring and source actions can be accessed via a quick
menu. Select the element to be manipulated in the Java editor or in a
Java view and press <b>Alt+Shift+S</b> for the quick source menu,
<b>Alt+Shift+T</b> for the quick refactoring menu and <b>Alt+Shift+Z</b> for the surround with menu.
<p><img border="0" src="images/quick-refactoring-menu.png" alt="Quick refactoring menu"></p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Find unused code</b></td>
<td width="80%" valign="top" align="left">The Java compiler detects
unreachable code, unused variables, parameters, imports and unused
private types, methods and fields.
Change the settings for the detection on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the error/warning preference page">
<b>Java &gt; Compiler &gt; Error/Warnings</b></a>
preference page. These settings can also be specified per project, use: <b>Project &gt; Properties &gt; Java Compiler &gt;
Error/Warnings</b>.<p><img src="images/warn-privates.png" border="0" alt="Compiler preference page">
</p>
These problems are detected as you type, and a quick fix is
offered to remove the unneeded code.
You can also use <b>Source &gt; Clean Up...</b> to remove unused code.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Find problems with null</b>
</td>
<td width="80%" valign="top" align="left">The compiler can help you find problems with <code>null</code> in your code.
The
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Errors/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a>
preference page has three options to detect problems:
<ul>
<li><b>Null pointer access</b> (in 'Null analysis')<br>
When this option is enabled, the compiler will issue an error or warning
whenever a variable that is statically known to hold a null value
is used to access a field or method, as shown in the example below:
<p><img src="images/null-reference.png" alt="Null pointer access example"></p><br>
</li>
<li><b>Potential null pointer access</b> (in 'Null analysis')<br>
When this option is enabled, the compiler will issue an error or a
warning whenever a variable is statically known to potentially hold
a null value, as shown in the example below:
<p><img src="images/potential-null-ref.png" alt="Potential null pointer access example"></p><br>
</li>
<li><b>Redundant null check</b> (in 'Null analysis')<br>
When enabled, the compiler will issue an error or a warning whenever
a variable that is statically known to hold a null or a non-null
value is tested against null, as shown in the examples below:
<p><img src="images/instanceof-always-false.png" alt="Redundant null check example (instanceof always false)"></p>
<br>
<p><img src="images/redundant-null-check.png" alt="Redundant null check example"></p>
</li>
</ul>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Find problems with externalized strings</b>
</td>
<td width="80%" valign="top" align="left">The <b>Source &gt; Find Broken Externalized Strings</b> action
finds undefined, unused and duplicate keys for you:
<p><img src="images/nls-problem-search.png" alt="Externalized string search result example"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Change problem severity</b></td>
<td width="80%" valign="top" align="left">
You can configure the severity of a compiler problem by invoking the <b>Quick Fix</b> (<b>Ctrl+1</b>) which opens the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Errors/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page and highlights the configurable problem.
<p>
<img src="images/configure-problem-severity.png" alt="">
</p>
In older Eclipse versions, this was a toolbar button in enriched hovers (i.e., you had to press F2 or move the mouse into the hover to see it).
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Javadoc comment handling</b></td>
<td>The Eclipse Java compiler can process Javadoc comments. Search
reports references in doc comments, and refactoring updates these
references as well. This feature is controlled from the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavadocProblemsPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Javadoc problems preference page">
<b>Java &gt; Compiler &gt; Javadoc</b></a>
preference page (or set for an individual
project using <b>Project &gt; Properties &gt; Java Compiler &gt;
Javadoc</b>).
<p><img src="images/javadoc-prefs.png" alt="Javadoc preference page">
</p>When turned on, malformed Javadoc comments are marked in the Java editor and can be fixed using <b>Edit
&gt; Quick Fix (Ctrl+1)</b>:
<p>
<img src="images/javadoc-quickfix.png" alt="Problems detected in Javadoc" title="Problems detected in Javadoc">
</p></td>
</tr>
<tr>
<td valign="top" align="left"><b>Suppress warnings</b></td>
<td>In J2SE 5.0 and later, you can suppress all optional compile warnings using the <code>SuppressWarnings</code> annotation.<br>
In this example, <code>addAll()</code> is marked as an unused method. <b>Quick Fix (Ctrl+1)</b> is used to add a <code>SuppressWarnings</code> annotation so that the warning will not be shown for this method.<br>
<img src="images/suppresswarningsR31.png" border="0"
alt="Quick fix to add SuppressWarning annotation">
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Clean Ups</b>
</td>
<td><b>Source &gt; Clean Up...</b> helps fixing multiple
problems at once and helps to establish a consistent code style. For instance, you can:
<ul>
<li>convert all <code>for</code> loops to enhanced <code>for</code>
loops where possible. </li>
<li>mark all overriding methods in a whole project with an <code>@Override</code> annotation. </li>
<li>organize imports</li>
<li>format your code</li>
<li>remove unnecessary code</li>
</ul>
<p>Clean Ups are organized in Clean Up profiles.
A profile can be attached to the workspace or to individual projects.
Project settings can be shared in a team through a version control system.
It is also possible to export and import each profile.</p>
<p> <img src="images/cleanupprofiles.png" alt="Clean Up preference page"></p>
<p>
Clean Ups can be executed as save actions on save. Go to the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.SaveParticipantPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Save Actions preference page">
<b>Java &gt; Editor &gt; Save Actions</b></a> preference page to configure
which clean ups to invoke on save.
</p>
</td>
</tr>
</tbody>
</table>
<h3><a name="refactor_section"></a>Refactoring</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670" summary="Refactoring tips and tricks">
<tbody>
<tr>
<td width="20%" valign="top" align="left"><b>Scripting of refactorings</b>
</td>
<td valign="top" align="left" width="80%">
Most of the refactorings offered by JDT can not only be executed interactively, but also by a refactoring script.<br><br>
Create a refactoring script from the refactoring history using <b>Refactor &gt; Create Script...</b>.<br><br>A refactoring script
can then be applied later on an arbitrary workspace using <b>Refactor &gt; Apply Script...</b>.<br><br>
Such refactoring scripts can be used in different scenarios such as automatic fixing of breaking API changes between software layers
or providing patches with rich semantics.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Safe JAR file migration</b>
</td>
<td valign="top" align="left" width="80%">
When exporting a JAR file from the workspace, the JAR Export Wizard offers the option
to include refactoring information into the JAR file.<br><br>
Use <b>File &gt; Export...</b> and select <b>JAR file</b>. On the first page of the JAR Export Wizard, select
<b>Export refactorings for checked projects</b>. Click on the link to select the refactorings to include.<br><br>
Clients are then able to migrate an old version of the JAR file to a new one using the <b>Refactor &gt; Migrate JAR File...</b> refactoring. This refactoring
automatically updates all code which is dependent on the old version of the JAR file to use the new version of the JAR file.
</td>
</tr>
</tbody>
</table>
<h3><a name="searching_section"></a>Searching</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670" summary="Searching tips and tricks">
<tbody>
<tr>
<td width="20%" valign="top" align="left"><b>Locate variables and
their read/write access</b></td>
<td valign="top" align="left" width="80%"><a name="search_occurrences"></a>You can locate variables
and see their read/write status by selecting an identifier
(variable, method or type reference or declaration) and invoking <b>Search
&gt; Occurrences in File &gt; Identifier</b>. This marks all references of this
identifier in the same file. The results are also shown in the search
view with different colors for read or write access, along with icons
showing the variable's read or write access.<br>
<p><img src="images/link-with-editor-in-occs.png" border="0" alt="Read and write accesses to a field">
</p>
<p>Alternatively, use the <b><a href="#mark_occurrences">Mark
Occurrences</a></b> feature to dynamically highlight occurrences.
You can search over several files by using the general search
features (<b>Search &gt; References</b>).
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Search for methods with
a specific return type</b></td>
<td valign="top" align="left" width="80%">
To search for methods with a specific return type, use &quot;*
&lt;return type&gt;&quot; as follows:
<ul>
<li>Open the search dialog and click on the <b>Java Search</b> tab.</li>
<li>Type '*' and the return type, separated by a space, in the <b>Search
string</b>.</li>
<li>Select the <b>Case sensitive</b> checkbox.</li>
<li>Select <b>Method</b> and <b>Declarations</b> and then click <b>Search.</b></li>
</ul>
<p><img src="images/search-returntype.png" border="0" alt="Search for method with given return type">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Filter search matches in Javadoc</b></td>
<td width="80%" valign="top" align="left">By default, <b>Java Search</b> finds references inside
Java code and Javadoc. If you don't want to see the references inside Javadoc, you can filter these
matches by enabling 'Filter Javadoc' in the view menu (triangle symbol) of the search view.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Filter potential search matches</b></td>
<td width="80%" valign="top" align="left">Potential matches occur when a compile-time problem
prevents the search engine from completely resolving the match. Filter these matches with <b>Filter Potential</b>
in the search view menu (triangle symbol).</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Trace method call chains
with the Call Hierarchy</b></td>
<td valign="top" align="left" width="80%">
Use the Call Hierarchy to follow long or complex
call chains without losing the original context: Just select a method
and invoke <b>Navigate &gt; Open Call Hierarchy (Ctrl+Alt+H)</b>.
<p><img src="images/call_hierarchy.png" border="0" alt="Call Hierarchy View"></p>
<p>You can also use drag and drop to replace the view input with the selected methods.
<b>Ctrl+drag</b> adds the selected methods to the existing elements in the view.</p>
<p>Methods from anonymous classes or special types like <code>Runnable</code> are
by default expanded with constructors, since it is often more interesting to
see where the object is created than where the method is invoked.
<b>Expand with Constructors</b> from the context menu toggles this behavior. The defaults can
be configured in the view menu.
</p>
</td>
</tr>
</tbody>
</table>
<h3><a name="navigation_section"></a>Code navigation and reading</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670" summary="Code navigation and reading tips and tricks">
<tbody>
<tr>
<td width="20%" valign="top" align="left"><b>Open selection in
Java editor</b></td>
<td valign="top" align="left" width="80%">There are two ways how you
can open an element from a reference in the Java editor.
<ul>
<li>Select the reference in the code and press <b>F3 (Navigate &gt;
Open Declaration)</b></li>
<li>Hold <b>Ctrl</b>, move the mouse pointer over the reference, and click the hyperlink</li>
</ul>
<img src="images/editor-link-style-open.png" border="0" alt="Hyperlink style navigation">
<br>
<p>
Holding <b>Ctrl</b> on a class, interface or overridable method shows a popup with an <b>Open Implementation</b> entry, which directly
opens the implementation in case there's only one, or shows all the concrete implementations for that element using the quick type hierarchy.
</p>
The hyperlink style navigation can be configured on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.editors.preferencePages.HyperlinkDetectorsPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the hyperlinking preference page">
<b>General &gt; Editors &gt; Text Editors &gt; Hyperlinking</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>In-place outlines</b></td>
<td valign="top" align="left" width="80%">Press <b>Ctrl+F3</b> in the
Java editor to pop up an in-place outline of the element at the
current cursor position. Or press <b>Ctrl+O (Navigate &gt; Quick
Outline)</b> to pop up an in-place outline of the current source
file.
<p><img src="images/inplace_outline.png" border="0" alt="Inplace outline">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>In-place outlines show inherited members</b></td>
<td valign="top" align="left" width="80%">Press <b>Ctrl+O</b> or <b>Ctrl+F3</b>
again to add inherited members to an open In-place outline. Inherited members have a blue label.
Filter and sort the outline with the menu in the upper right corner.
<p><img src="images/quick-outline-inherited.png" border="0" alt="Quick outline view"></p>
The <b>Quick Outline (Ctrl+O)</b> also shows inherited members of the type that contains the current editor selection.
The focus types that can show inherited members are marked with a triangle ( <img src="images/focus-ovr.png" alt="Focus adornment"> ).
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>In-place hierarchy</b></td>
<td valign="top" align="left" width="80%">Find out which are the
possible receivers of a virtual call using the <b>Quick Type Hierarchy</b>.
Place the cursor inside the method call and press
<b>Ctrl+T (Navigate&nbsp;&gt;&nbsp;Quick Type Hierarchy)</b>.
The view shows all types that implement the method with a full icon.
<p><img border="0" src="images/type-hierarchy-structured-view.png"
alt="Quick Type Hierarchy dialog">
</p>
<p>Press <b>Enter</b> to open the corresponding method in an editor. Press <b>Ctrl+T</b> again to switch
to the Supertype hierarchy.</p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Java Editor Breadcrumb</b></td>
<td valign="top" align="left" width="80%">The Java Editor contains a breadcrumb navigation bar which
shows the path to the element at the cursor position. The breadcrumb can be enabled via
the <b>Toggle Breadcrumb</b> tool bar button or by pressing <b>Alt+Shift+B</b>.
<p><img border="0" src="images/breadcrumb.png" alt="Java Editor Breadcrumb">
</p>
<p>Each element in the breadcrumb can be selected and actions can be invoked through a
context menu or keyboard short cuts. Furthermore the breadcrumb lets you navigate to other
elements via drop-downs.
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Advanced highlighting</b></td>
<td align="left" valign="top">
The Java editor can highlight source code according to its
semantics (for example: static fields, local variables, static method
invocations). Have a look at the various options on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaEditorColoringPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the syntax coloring preference page">
<b>Java &gt; Editor &gt; Syntax Coloring</b></a>
preference page.<p><img src="images/advanced-highlighting.png" alt="An example of advanced highlighting." title="Advanced Highlighting" align="middle">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Initially folded regions</b></td>
<td>You can specify which regions are folded by default when an editor is opened. Have a look at the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.FoldingPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the folding preference page">
<b>Java &gt; Editor &gt; Folding</b></a>
preference page to customize this.<p><img src="images/folding-preferences.png" alt="Folding preference page" title="Folding Preference Page" align="middle">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Mark occurrences</b></td>
<td valign="top" align="left" width="80%">
<a name="mark_occurrences"></a>When working in the
editor, turn on <b>Mark Occurrences</b> in the toolbar (<img src="../images/org.eclipse.jdt.ui/etool16/mark_occurrences.png" alt="Picture of Mark Occurrences Toolbar Button" title="Picture of Mark Occurrences Toolbar Button">
) or
press <b>Alt+Shift+O</b>. You'll see within a file, where a
variable, method or type is referenced.
<p>
<img border="0" src="images/mark-occurrences.png" alt="Editor with occurrences of 'info' marked"><br>
</p>
<p>Different colors are used to mark read and write accesses.</p>
<p>Selecting a return type shows you the method's exit points. Select an
exception to see where it is thrown.
Select a super class or interface to see the methods override or implement a method from the selected super type.</p>
<p>Fine tune 'mark occurrences' on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.MarkOccurrencesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the mark occurrence page">
<b>Java &gt; Editor &gt; Mark Occurrences</b></a> preference page.
<br>
Change the color for to marker on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.editors.preferencePages.Annotations)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the annotations page">
<b>General &gt; Editors &gt; Text Editors &gt; Annotations</b></a> preference page.
</p>
<p>To show occurrences in the Search view, use the
<a href="#search_occurrences"><b>Search &gt; Occurrences</b></a> feature.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Go to next / previous
method</b></td>
<td valign="top" align="left" width="80%">To quickly navigate to the
next or previous method or field, use<br>
<b>Ctrl+Shift+Arrow Up (Navigate &gt; Go To &gt; Previous Member</b>)
or <b>Ctrl+Shift+Arrow Down (Navigate &gt; Go To &gt; Next Member)</b></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Control your navigation between annotations</b></td>
<td>
Use the Next / Previous Annotation toolbar buttons or <b>Navigate
&gt; Next Annotation</b> (<b>Ctrl+.</b>) and <b>Navigate &gt; Previous
Annotation</b> (<b>Ctrl+,</b>) to navigate between annotations
in a Java source file.
With the button drop-down menus, you can configure on which annotations you want to stop:
<p><img src="images/annotation-navigation.png" alt="Next/Previous annotation drop-down." title="Next/Previous Annotation Drop-Down" align="middle">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Reminders in your Java
code</b></td>
<td valign="top" align="left" width="80%">When you tag a comment in
Java source code with "TODO" the Java compiler automatically creates
a corresponding task as a reminder. Opening the task navigates you
back to the "TODO" in the code. Use the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.TodoTaskPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the todo page">
<b>Java &gt; Compiler &gt; Task Tags</b></a>
preference page to configure any other special tags (like "FIXME") that you'd
like to track in the task list.<p><img src="images/todo-example.png" border="0" alt="Task tags in editor and task view">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Open from Clipboard</b><br></td>
<td valign="top" align="left" width="80%">
The <b>Navigate &gt; Open from Clipboard</b> (<b>Ctrl+Shift+V</b>) command tries to navigate to the matching Java element in the editor if the clipboard contains a single line.
Otherwise it opens the contents in the Java Stack Trace Console.
<p>For example, to quickly find a Java element from a stack trace, copy a line from the stack trace, say, <code>at java.lang.String.matches(String.java:1550)</code>, and
go to <b>Navigate &gt; Open from Clipboard</b> to open the <code>String</code> class at line number <code>1550</code>.</p>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Tricks in the Open Type dialog</b><br>
</td>
<td valign="top" align="left" width="80%">
The Open Type dialog (<b>Navigate &gt; Open Type</b> or toolbar button) helps you navigate to a type
by its name.
<ul>
<li>To find types quickly, only type the capital letters of the type name:<br>
<code>IOOBE</code> finds <code>IndexOutOfBoundsException</code>.<br>
Or type the first few characters of each name part:<br>
<code>NuPoiE</code> finds <code>NullPointerException</code>.</li>
<li>To see all types ending with a given suffix, e.g. all Tests, use <tt>*Test&lt;</tt>
to not see all types containing <tt>Test</tt> somewhere else in the type name.</li>
<li>To open multiple types at once, select them in the list and click OK.</li>
</ul>
<img border="0" src="images/open-type-camel-case.png"
alt="Open type dialog with camel case matching"></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b> Make hovers sticky</b></td>
<td valign="top" align="left" width="80%">You can open the text from
a hover in a scrollable window by pressing <b>F2 (Edit &gt; Show
Tooltip Description)</b> or by moving your mouse pointer into the hover. You can select and copy content from this
window, invoke actions, or follow links.
<p><img src="images/javadoc-hover.png" border="0" alt="Window containing content of the hover">
</p>
<p> You can configure how to enrich the hover on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.GeneralTextEditor)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Text Editors preference page">
<b>General &gt; Editors &gt; Text Editors</b></a> preference page.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Hovers in the Java
editor</b></td>
<td valign="top" align="left" width="80%">You can see different hovers in the
Java editor by using the
modifier keys (<b>Shift</b>, <b>Ctrl</b>, <b>Alt</b>). <br>
When you move the mouse over an identifier that has no warning or problem annotation in the Java editor, by
default a hover with the Javadoc extracted from the corresponding
source of this element is shown. If there's a problem annotation on the identifier then the hover
shows the corresponding message. Holding down the <b>Shift</b> key shows you
the source code:
<p><img src="images/editor-code-hover.png" border="0" alt="Hover showing code of the element in the hover">
</p>
You can change this behavior and define the hovers for other modifier
keys in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.JavaEditorHoverPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the hovers page">
<b>Java &gt; Editor &gt; Hovers</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Generic method inferred signature</b><br>
</td>
<td valign="top" align="left" width="80%">You can use hover to show the inferred signature of a generic method.
<p><img src="images/hovergenericsignature.png" border="0" alt="Hover showing generic method inferred signature">
</p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Open and configure
external Javadoc documentation</b></td>
<td valign="top" align="left" width="80%">If you want to open the
Javadoc documentation for a type, method or field with <b>Shift+F2
(Navigate &gt; Open External Javadoc)</b>, you first have to specify
the documentation locations to the elements parent library (JAR,
class folder) or project (source folder).<br>
For libraries, open the build path page (<b>Project &gt; Properties
&gt; Java Build Path</b>), go to the <b>Libraries</b>, and expand the
node of the library where you can edit the 'Javadoc location' node.
The documentation can be local on your file system in a folder or
archive, or on a web server.
<p><img src="images/javadoc-location.png" border="0" alt="Configuring Javadoc location in the Java build path dialog">
</p>
For types, methods or fields in source folders, go to the (<b>Project
&gt; Properties &gt; Javadoc Location</b>).</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Find the method implemented by functional interface instances</b></td>
<td valign="top" align="left" width="80%">To show the method implemented by functional interface instances, you can hover on:
<ul>
<li>'<code>-&gt;</code>' in a lambda expression</li>
</ul>
<p><img src="images/hover-on-lambda.png" alt="hover on '->' in lambda to show functional method"></p>
<ul>
<li>'<code>::</code>' in a method reference</li>
</ul>
<p><img src="images/hover-on-method-reference.png" alt="hover on '::' in method reference to show functional method"></p>
To navigate to the functional method, hold <b>Ctrl</b>, move the mouse pointer over '<code>-&gt;</code>' or '<code>::</code>', and click the hyperlink.
</td>
</tr>
</tbody>
</table>
<h3><a name="views_section"></a>Java views</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670">
<tbody>
<tr>
<td valign="top" align="left">
<b>Organizing workspace with many projects</b>
</td>
<td>Use <b>Top Level Elements &gt; Working Sets</b> in the Package Explorer's view menu to enable
a new mode that shows working sets as top level elements. This mode makes it
much easier to manage workspaces containing lots of projects.
<p><img alt="Package Explorer in Working Set mode"
src="images/package-explorer.png"></p>
<p>Use <b>Configure Working Sets...</b> from the Package Explorer's view
menu to configure which working sets get shown. The dialog lets you
create new Java working sets, define which working sets are shown and
in what order. If <b>Sort Working Sets</b> is not enabled, working sets can also be rearranged directly in the
Package Explorer using drag and drop.</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Assign working sets</b>
</td>
<td>To assign an element to a different working
set, select the element in the Package Explorer and choose <b>Assign Working
Sets...</b> from the context menu.
<p> <img src="images/working-set-selection.png" alt="Screenshot showing the working set assignment dialog"> </p></td>
</tr>
<tr>
<td valign="top" align="left"><b>Declaration view</b></td>
<td>The Declaration view (
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.SourceView)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Java Declaration view">
<b>Window &gt; Show View &gt; Other... &gt; Java &gt; Declaration</b></a>) shows the source of the
element selected in the Java editor or in a Java view.
<p><img src="images/DeclarationView.png" title="Declaration view" alt="Declaration view">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Javadoc view</b></td>
<td>The Javadoc view (
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.views.showView(org.eclipse.ui.views.showView.viewId=org.eclipse.jdt.ui.JavadocView)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Javadoc view">
<b>Window &gt; Show View &gt; Other... &gt; Java &gt; Javadoc</b></a>) shows the Javadoc of the element
selected in the Java editor or in a Java view.
<p><img src="images/javadoc-view.png" title="Javadoc view" alt="Javadoc view">
</p>
</td>
</tr><tr>
<td width="20%" valign="top" align="left"><b>Type Hierarchy view and method
implementations&nbsp;/ definitions</b></td>
<td valign="top" align="left" width="80%">To find out
which types in a hierarchy override a method, use the 'Show Members in
Hierarchy' feature:
<ol>
<li>Select the method to look at and press <b>F4 (Navigate &gt; Open
Type Hierarchy)</b>. This opens the Type Hierarchy view on the
method's declaring type.</li>
<li>With the method selected in the Type Hierarchy view, press the 'Lock
View and Show Members in Hierarchy' tool bar button.</li>
</ol>
The Type Hierarchy view now shows only types that implement or define
the 'locked' method. You can for example see that <code>isEmpty()</code> is
defined in <code>List</code> and implemented in <code>ArrayList</code> and <code>Vector</code> but
not in <code>AbstractList</code>.
<p><img src="images/hierarchy-lockview.png" border="0" alt="Lock view and show members in Hierarchy">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Type Hierarchy view
supports grouping by defining type</b></td>
<td valign="top" align="left" width="80%">The type hierarchy method
view lets you sort the selected type's methods by its defining types.
For example, for <code>AbstractList</code> you can see that it contains methods
that were defined in Object, Collection and List:
<p><img src="images/sort-by-def.png" border="0" alt="Sort members by the defining type in the type hierarchy">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Tricks in the type
hierarchy</b></td>
<td valign="top" align="left" width="80%">
<ul>
<li>Focus the type hierarchy on a new type by pressing <b>F4
(Navigate &gt; Open Type Hierarchy)</b> on an element or a selected
name.</li>
<li>You can open the Type Hierarchy view not only on types but also on
packages, source folders, JAR archives and Java projects. You can select
multiple packages, source folders, or projects, and then open a hierarchy
that contains all types in the selected containers.</li>
<li>You can Drag &amp; Drop an element onto the Type Hierarchy view to
focus on that element.</li>
<li>You can change the orientation (from the default vertical to
horizontal) of the Type Hierarchy view from the view's toolbar menu.</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Structural compare of Java source</b>
</td>
<td valign="top" align="left">A structural comparison of Java source
ignores the textual order of Java elements like methods and fields
and shows more clearly which elements were changed, added, or removed. <br>
For initiating a structural comparison of Java files you have two
options:
<ul>
<li>Select two Java compilation units and choose <b>Compare With</b>
&gt; <b>Each Other</b> from the view's context menu. If the files
have differences, they are opened into a Compare Editor. The top
pane shows the differing Java elements; double clicking on one of
them shows the source of the element in the bottom pane.</li>
<li>In any context where a file comparison is involved (e.g. a CVS
Synchronization) a double click on a Java file not only shows the
content of the file in a text compare viewer, but it also performs a
structural compare and opens a new pane showing the results.</li>
</ul>
<p><img src="images/compare-java.png" alt="Structural compare of Java source">
</p>
You can even ignore formatting changes when performing
the structural compare: turn on the <strong>Ignore Whitespace</strong>
option via the Compare Editor's toolbar button, or a compare viewer's context menu.</td>
</tr><tr>
<td valign="top" align="left"><b>Structural compare of property
files</b></td>
<td valign="top" align="left">A structural comparison of Java
property files (extension: .properties) ignores the textual order of
properties and shows which properties were changed, added, or
removed. <br>
For initiating a structural comparison of property files you have two
options:
<ul>
<li>Select two files in the Package Explorer or Navigator and choose
<b>Compare With</b> &gt; <b>Each Other</b> from the view's context
menu.</li>
<li>In any context where a file comparison is involved (e.g. a CVS
Synchronization) a double click on a property file not only shows
the content of the file in a text compare viewer, but it also
performs a structural compare and opens a new pane showing the
results.</li>
</ul>
<p><img src="images/compare-properties.png" alt="Structural compare of property files">
</p>
</td>
</tr><tr>
<td width="20%" valign="top" align="left"><b>Hierarchical vs. flat
presentation of packages</b></td>
<td valign="top" align="left" width="80%">An option on the Java
Packages (and Package Explorer) view menu allows you to change the
way packages are displayed. <b>Package Presentation &gt; Hierarchical</b> displays packages in
a tree, with sub-packages below packages; <b>Package Presentation &gt; Flat</b> displays them
in the standard arrangement, as a flat list with all packages and
sub-packages as siblings.<br>
<table border="0">
<tbody>
<tr align="left" valign="top">
<td><img src="images/packages-flat.png" border="0" alt="Flat packages layout">
</td>
<td><img src="images/packages-hierarchical.png" border="0" alt="Hierarchical package layout">
</td>
</tr>
</tbody>
</table>
</td>
</tr><tr>
<td width="20%" valign="top" align="left"><b>Logical packages</b></td>
<td valign="top" align="left" width="80%">The Java Packages view
(Java Browsing perspective) coalesces packages of the same name
across source folders within a project. The screenshot shows the Packages view
containing a logical package.
<p><img src="images/packages-compound.png" border="0" alt="Java browsing perspective containing a logical package" align="bottom">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Compress package names</b></td>
<td valign="top" align="left" width="80%">If your package names are
very long, you can configure a compressed name that appears in the viewers.
Configuration of the compression pattern is done in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.AppearancePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Appearance preference page">
<b>Java &gt; Appearance</b></a> preference page.
<p><img src="images/compress-packages1.png" border="0" alt="Compression pattern configuration in the Java appearance preference page">
</p>
Using this example, packages are rendered the following way:<p><img src="images/compress-packages2.png" border="0" alt="Compressed package names">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Package name abbreviations</b></td>
<td valign="top" align="left" width="80%">Package names in Java views can be abbreviated with custom rules. For example,
the following rules produce the rendering shown below:
<pre>org.eclipse.ui={UI}
org.eclipse.ui.texteditor={T}
org.eclipse.ui.internal.texteditor=[iT]</pre>
<table cellpadding="0" cellspacing="0" summary="Screenshots">
<tr>
<td>Without abbreviations:</td>
<td>With abbreviations:</td>
</tr>
<tr>
<td style="padding-top:2px; padding-right:4px;"><img src="images/package-abbreviations-off.png" alt="Package Explorer with abbreviations disabled"></td>
<td style="padding-top:2px;"><img src="images/package-abbreviations-on.png" alt="Package Explorer with abbreviations enabled"></td>
</tr>
</table>
<p>The abbreviation rules can be configured on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.AppearancePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Appearance preference page">
<b>Java &gt; Appearance</b></a> preference page.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Manipulating the Java
build path directly in the Package Explorer</b>
</td>
<td valign="top" align="left" width="80%">Instead of manipulating the Java Build path on <b>Project
&gt; Properties &gt; Java Build Path</b>, use the actions in the Package Explorer's context menu.
<br>You can for example add new source folders, archives and libraries to the build path or in- and exclude file and folders from a source folder.
<p><img border="0" src="images/build-path-actions.png"
alt="Build path context menu"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Paste code snippets to create a type</b>
</td>
<td valign="top" align="left" width="80%">You can paste a snippet of code containing a Java type directly
into a package or source folder to create a new compilation unit.
For example, select and copy this source code:
<pre>
package pack;
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello World");
}
}
</pre>
Then select a source folder in the Package Explorer and use <b>Ctrl+V (Edit &gt; Paste)</b>.
This automatically creates a new package 'pack' and file 'HelloWorld.java' with the copied content.
<p>You can also paste a method or a set of statements; Eclipse will create the required enclosing
elements for you.</p>
<p>If you paste while nothing is selected in the Package Explorer, Eclipse
even creates a new Java Project and create the *.java file there.
Furthermore, the clipboard can also contain multiple package and type declarations,
in which case Eclipse will create all the necessary packages and *.java files on paste.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Paste patch into Package Explorer</b>
</td>
<td valign="top" align="left" width="80%">
What's the quickest way to apply a patch from Bugzilla? Just open the attachment,
copy the patch to the clipboard and paste it into the Package Explorer.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Grouping Java problems</b>
</td>
<td valign="top" align="left" width="80%">
Configure the Problems view to group Java problems into categories with <b>Group by &gt; Java Problem Type</b>
in the view menu.
<p><img border="0" alt="picture of Problems view with grouped problems" title="Problems view with grouped problems" src="images/group-problems.png"></p>
You can control if a configurable error is intended to be fatal or not at the bottom of the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Errors/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Java type indicator</b>
</td>
<td valign="top" align="left" width="80%">
Enable the <b>Java Type Indicator</b> on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.ui.preferencePages.Decorators)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Label Decoration preference page">
<b>General &gt; Appearance &gt; Label Decoration</b></a> preference page to find
out what the first type in a compilation unit or class file is. An adornment is shown for interfaces, annotations, and enums, while an ordinary class stays undecorated.
<p><img title="Java Type Indicator Label Decorator" alt="Picture of Java Type Indicator Label Decorator" src="images/type-indicator.png"></p>
</td>
</tr>
</tbody>
</table>
<h3><a name="misc_section"></a>Miscellaneous</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670">
<tbody>
<tr>
<td width="20%" valign="top" align="left"><b>Project specific
preferences</b></td>
<td valign="top" align="left" width="80%">All code style and compiler options can be defined per project.<br>
Open the project property pages with <b>Project &gt; Properties</b> on a project or use the link on the workspace preferences (e.g. 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)
to open a project property page and enable project specific settings.<br>
<p><img border="0" src="images/project-specific-settings.png"
alt="Project property page with 'Enable project specific settings' checkbox"></p>
The project specific settings are stored in a configuration file inside the project (in the '.settings' folder). When you share a project in a team, team members will also get these project specific settings.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Access rules</b><br>
</td>
<td valign="top" align="left" width="80%">Access rules give you the possibility to enforce API rules for types from referenced libraries. On the Java build path page (<b>Project
&gt; Properties &gt; Java Build Path</b>) edit the 'Access Rules' node available on referenced projects, archives, class folders and libraries.<br>
Packages or types in these references can be classified as:<ul>
<li>Accessible</li>
<li>Discouraged</li>
<li>Forbidden</li>
</ul>According to the settings on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Error/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page,
the compiler will mark discouraged and forbidden references with warning or errors.
<p><img border="0" src="images/type-access-rules.png" alt="Access rules configuration dialog"></p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>JUnit</b></td>
<td valign="top" align="left" width="80%">Select a JUnit test method
in a view and choose <b>Run &gt; JUnit Test</b> from the context menu or <b>Run
&gt; Run As &gt; JUnit Test</b> from the main menu. This
creates a launch configuration to run the selected test.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Hide JUnit view until
errors or failures occur</b></td>
<td valign="top" align="left" width="80%">You can configure the JUnit view
to only open when there are errors or failures. To do so enable <b>Activate on Errors/Failures only</b>
in the JUnit view menu. That way, you can have
the view set as a fast view and never look at it when there are no
failing tests. While there are no problems in your tests you will see
this icon <img src="../images/org.eclipse.jdt.junit/prgss/ss4.png" alt="Successfully running"> (the
number of small green squares will grow, indicating progress)
while running them and this icon <img src="../images/org.eclipse.jdt.junit/eview16/junitsucc.png" alt="Successfully finished">
after they are finished. If, however,
errors or failures occur, the icon will change to <img src="../images/org.eclipse.jdt.junit/prgss/ff4.png" alt="Failure or error occurred">
(or <img src="../images/org.eclipse.jdt.junit/eview16/juniterr.png" alt="Finished with failure or error">
if
tests are finished) and the JUnit view will appear.</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><img src="images/new.png" alt=""><b>Show JUnit failure trace in Console view</b></td>
<td valign="top" align="left" width="80%">
You can show the stack trace of a failed JUnit test in the <b>Console</b> view via the button on the JUnit Failure Trace header.
The Console view makes it convenient to view a long and wide stack trace, copy parts of the stack trace and navigate to the classes on the stack trace using hyperlinks.
<p>
<img src="images/show-junit-failure-trace-in-console-view.png" alt="">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Content assist in dialog fields</b>
</td>
<td>Content assist (<b>Ctrl+Space</b>) is also available in input fields
of various Java dialogs. Look for a small light bulb icon beside the
field when it has focus.
<p><img src="images/new-class.png" alt="New Class Dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Smart caret positioning in dialogs showing Java names</b>
</td>
<td width="80%" valign="top" align="left">
Text fields for editing Java names support smart caret positioning. Use <b>Ctrl+Left</b> and <b>Ctrl+Right</b> to
stop at camel case boundaries inside a name. Use <b>Ctrl+Shift+Left</b> and <b>Ctrl+Shift+Right</b> to extend the selection in small steps.
Use <b>Ctrl+Delete</b> to delete the next and <b>Ctrl+Backspace</b> to delete the previous part of a name.<br>
<table border="0" cellpadding="2" cellspacing="2" width="100%">
<tbody>
<tr>
<td valign="middle"><br>
</td>
<td valign="middle"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-1.png"></td>
</tr>
<tr>
<td valign="middle"><b>Ctrl+Right:</b><br>
</td>
<td valign="middle"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-2.png"></td>
</tr>
<tr>
<td valign="middle"><b>Ctrl+Shift+Right:</b><br>
</td>
<td valign="top"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-3.png"></td>
</tr>
<tr>
<td valign="middle"><b>write "Equal":</b><br>
</td>
<td valign="top"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-5.png"></td>
</tr>
<tr>
<td valign="middle"><b>Ctrl+Delete:</b><br>
</td>
<td valign="top"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-6.png"></td>
</tr>
<tr>
<td valign="middle"><b>write "To":</b><br>
</td>
<td valign="top"><img alt="Smart caret positioning in dialog" src="images/camel-case-nav-7.png"></td>
</tr>
</tbody>
</table>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Define prefixes or
suffixes for fields, parameters and local variables</b></td>
<td valign="top" align="left" width="80%">You can configure
the prefix or suffix for fields, static fields, parameters, and local variables.
These settings on 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 are used
in content assist, quick fix, and refactoring whenever a variable
name is computed.
<p><img src="images/name-conventions.png" border="0" alt="Name conventions in the code style preference page">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Organize Imports works
on more than single files</b></td>
<td valign="top" align="left" width="80%">You can invoke <b>Source &gt; Organize
Imports</b> on sets of compilation units, packages, source folders or
Java projects.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Organize imports on save</b>
</td>
<td>Eclipse can automatically organize imports whenever you save an editor.
This feature can be enabled globally on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.SaveParticipantPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Save Actions preference page">
<b>Java &gt; Editor &gt; Save Actions</b></a> preference page.
The save actions can also be configured per project, which
makes it easy to enforce a project-wide standard by sharing
the settings across a team:
<p> <img src="images/organize-imports-on-save.png" alt="Save Action property page"> </p>
<p>Besides organizing imports, save actions can also format code and
perform other clean ups.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Format selection</b></td>
<td valign="top" align="left" width="80%">Select multiple
Java files to format and choose <b>Source &gt; Format</b> to format them
all. The format action is also available on packages, source folders
or Java projects.
<p>
In the Java Editor, <b>Source &gt; Format (Ctrl+Shift+F)</b> formats just
the selected region. If nothing is selected, the whole file gets formatted.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Select execution environment
for Java project</b>
</td>
<td>When you create a Java project that you want
to share with a team, it is a good idea to use an execution environment
instead of a specific JRE.
<p> Execution environments are symbolic representations of JREs with standardized
entries like 'J2SE-1.4', 'J2SE-1.5'. That means no file system path will
go into the shared build path.</p>
<p>JREs can be assigned to the environments on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.jreProfiles)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Execution Environments preference page">
<b>Java &gt; Installed JREs &gt; Execution Environments</b></a> preference page.</p>
<p> <img alt="Screenshot of the 'New Java Project' wizard" src="images/new-project-with-ee.png"></p>
<p>To set a project specific JRE of an existing project, open the
project's Java Build path property page <b>(Project &gt; Properties &gt; Java Build Path)</b>, then the<b> Libraries</b> page, select
'JRE System Library' and press <b>Edit</b>. In the 'Edit Library' dialog you can select either an Execution Environment, a project specific
JRE, or the workspace default JRE.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Use drag and drop</b></td>
<td valign="top" align="left" width="80%">
Drag and Drop is a handy replacement of <b>Edit &gt; Cut</b> and <b>Edit &gt; Paste</b>
, or <b>Edit &gt; Copy</b> and <b>Edit &gt; Paste</b>. Hold
down the <b>Ctrl</b> key while dropping to change from move to copy.
<p>Important to know:</p>
<ul>
<li>If you move Java
compilation units between packages by Drag &amp; Drop, this will behave like a refactoring move - all missing
imports will be added and references updated
</li>
<li>
If you drag and drop source elements like types or methods, this will only copy or move the corresponding
source code - no references will be updated
</li>
</ul>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Propagating deprecation
tag</b></td>
<td width="80%" valign="top" align="left">
The Java compiler can be configured to diagnose deprecation using
options on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Error/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page.
<p><img src="images/warn-deprecation-opt.png" border="0" alt="Compiler preference page">
</p>
Using this configuration, the result is:
<p><img src="images/warn-deprecation-i.png" border="0" alt="I.java"></p>
<p><img src="images/warn-deprecation-x.png" border="0" alt="X.java"></p>
<p><img src="images/warn-deprecation-y.png" border="0" alt="Y.java"></p>
If you're unable to fix a usage of a deprecated construct, we recommend that you
tag the enclosing method, field or type as deprecated.
This way, you acknowledge that you did override a deprecated construct,
and the deprecation flag is propagated to further dependents.
<p><img src="images/warn-deprecation-x2.png" border="0" alt="X.java"></p>
<p><img src="images/warn-deprecation-y2.png" border="0" alt="Y.java"></p></td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Recovering from abnormal
inconsistencies</b></td>
<td width="80%" valign="top" align="left">
In the rare event of a dysfunction, JDT could reveal some inconsistencies
such as:
<ul>
<li>missing results in a <b>Java Search</b> or <b>Open Type</b></li>
<li>invalid items in Package Explorer</li>
</ul>
<br>
To bring JDT into a consistent state again, the following actions need to be performed
in this exact order:
<ol>
<li>Close all projects using navigator <b>Close Project</b> menu action</li>
<li>Exit and restart Eclipse</li>
<li>Open all projects using navigator <b>Open Project</b> menu action</li>
<li>Manually trigger a clean build of entire workspace (<b>Project &gt;
Clean...</b>)</li>
</ol>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Build path error decorator</b></td>
<td width="80%" valign="top" align="left">
The <b>Package Explorer</b> and the <b>Project Explorer</b> show this error decorator
<img src="../images/org.eclipse.jdt.ui/ovr16/error_co_buildpath.png" alt="Build path error decorator">
on Java projects and working sets if they contain build path errors:
<p><img src="images/build-path-error-decorator.png" alt="Build path error decorator"></p>
In case of build path errors in the <b>Problems</b> view, first look in the <b>Package
Explorer</b> for this icon since it better indicates where the problem is.
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>'*.class without source' file type</b></td>
<td width="80%" valign="top" align="left">
The <b>*.class without source</b> file type allows to associate an internal or external editor
to class files that have no source attached. This e.g. allows to open the class file in a decompiler:
<p><img src="images/file-associations-page.png" alt="Screenshot of the 'File Associations' preference page"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Selectively ignore errors/warnings from source folders</b></td>
<td width="80%" valign="top" align="left">
You can configure JDT to ignore optional errors/warnings from certain source folders.
See <b>Project properties &gt; Java Build Path &gt; Compiler &gt; Source</b>.
<p><img src="images/ignore-warnings-source-folders.png" alt="Java Build path page with 'Ignore optional compile problems' highlighted"></p>
<p>
With this option set to <b>Yes</b>, JDT will suppress errors/warnings configured in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Errors/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page.
This can be desirable for source folders that contain auto-generated classes or tests.
</p>
</td>
</tr>
<tr id="unavoidable-generic-type-problems">
<td width="20%" valign="top" align="left"><b>Ignore unavoidable generic type problems</b></td>
<td width="80%" valign="top" align="left">
When working with Java libraries whose APIs have not been generified yet, you sometimes
run into type safety problems that cannot be avoided due to references to an old API that uses raw types.
<p><a href="images/unavoidable-generic-type-problems-example.txt"><img src="images/unavoidable-generic-type-problems-example.png" alt=""></a></p>
Such problems can be ignored with the <b>Ignore unavoidable generic type problems due to raw APIs</b> compiler option.
<p>When the old API is eventually generified, then most of these problems either go away,
or you will see a compile error because the type arguments you used are not correct.
For raw references in method signatures, the raw type problem will reappear.</p>
<p>This option is disabled by default but can be enabled on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ProblemSeveritiesPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Errors/Warnings preference page">
<b>Java &gt; Compiler &gt; Errors/Warnings</b></a> preference page.
</p>
</td>
</tr>
</tbody>
</table>
<h3><a name="debugging_section"></a>Debugging</h3>
<table border="1" cellpadding="10" cellspacing="0" width="670">
<tbody>
<tr>
<td width="20%" valign="top" align="left">
<p><b>Launching from the context menu</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>You can run and debug Java applications from the context menu.
You can launch a source file, package, method, type, etc. by
choosing <b>Run As</b> (or <b>Debug As</b>)<b> &gt; Java Application</b>
from the context menu in a view or editor. Alternatively, you can
use the Java application launch shortcut key binding (<b>Alt+Shift+D, J</b>). The
top level <b>Run As</b> (or <b>Debug As</b>) actions are also
sensitive to the current selection or active editor.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/context_menu_launch.png" alt="Context menu with launch option">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Evaluations in the
debugger</b></td>
<td width="80%" valign="top" align="left">
<p>Snippet evaluation is available from a number of places in the
debugger. Choosing <b>Display</b> or <b>Inspect</b> from the context
menu of the editor or <b>Variables view</b> will show the result in a
pop-up whose result can be sent to the <b>Display</b> or <b>Expressions
views</b>.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/inspect_popup.png" alt="Result of an inspect in a pop-up">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><img src="images/new.png" alt=""><b>Method result after step operations</b></td>
<td width="80%" valign="top" align="left">
During debugging, you can view the last method result (per return or throw) that was observed during <b>Step Into</b>, <b>Step Over</b>
or <b>Step Return</b>, as first line in the <b>Variables</b> view.
<p>
<img src="images/step-show-methodresult.png" alt="">
</p>
<p>
This can be disabled with the option
<b>Preferences &gt; Java &gt; Debug &gt; Show method result after a step operation (if supported by the VM; may be slow)</b>.
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>View management in non-Debug perspectives</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>The Debug view automatically manages debug related views based on the view selection
(displaying Java views for Java stack frames and C views for C stack frames,
for example). By default, this automatic view management only occurs in
the Debug perspective, but you can enable it for other perspectives via
the <b>View Management</b> preference page available from the <b>Debug
view</b> toolbar pull down.</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>Environment variables</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>You can specify the environment used to launch Java applications via
the <b>Environment</b> tab.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/env_tab.png" alt="Environment tab in the launch configuration dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>String substitutions</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>Variables are supported for many parameters of Java Application launch
configurations. Most fields that support variables have a <b>Variables...</b>
button next to them, such as the program and VM arguments fields. The
<b>Main Type</b> field supports variables as well; the <i>${java_type_name}</i>
variable allows you to create a configuration that will run the selected
type.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/args_tab.png" alt="Arguments tab in the launch configuration dialog">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><img src="images/new.png" alt="">
<b>Logical structures</b>
</td>
<td width="80%" valign="top" align="left">
The <b>Show Logical Structure</b> toggle on the <b>Variables</b> view toolbar
presents alternate structures for common types.
<p><img src="images/org.eclipse.jdt.debug.ui/jdt-debug-show-logical-structure-by-default.png" alt=""></p>
<p>
JDT provides logical views for Maps, Collections, and SWT Composites. You can define
logical structures for other types from the <b>Logical Structures</b>
preference page. The <b>Show Logical Structure</b> context menu lets you choose or edit the representation.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/jdt-debug-edit-logical-structure-context-menu.png" alt=""></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>Variable columns</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>Columns in the <b>Variables view</b> can be configured by selecting
<b>Layout &gt; Select Columns...</b> in the view menu. A dialog allows
you to select the columns to display. For example, a column
can be added to display instance counts of classes (when debugging with
JavaSE-1.6). Columns can be toggled on/off using the <b>Layout &gt; Show Columns</b>
action.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/select-columns.png" alt="Dialog used to select configure columns in the variables view"></p>
<p><img src="images/org.eclipse.jdt.debug.ui/variable-view-columns.png" alt="Column display in the variables view"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>Show references</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>When debugging with JavaSE-1.6, references to objects can be displayed in
the <b>Variables view</b> by selecting <b>Java &gt; Show References</b> in the
view menu. A &quot;<b>referenced from</b>&quot; entry will appear under each object
that can be expanded to show all references to that object. </p>
<p><img src="images/org.eclipse.jdt.debug.ui/show-references.png" alt="Display references in the variables view"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>All instances</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>When debugging with JavaSE-1.6, all instances of a class can be inspected by selecting a class
in an editor outline, variables view, compilation unit or class file editor and invoking
<b>All Instances...</b> from the context menu. A pop-up dialog will display all instances of the
selected class.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/all-instances.png" alt="Display references in the variables view"></p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left">
<p><b>Default VM arguments</b></p>
</td>
<td width="80%" valign="top" align="left">
<p>If you specify the same arguments to a certain VM frequently,
you can configure <b>Default VM Arguments</b> in the <b>Installed JREs</b>
preference page. This is more convenient than specifying them for
each launch configuration.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/def_vm_args.png" alt="JRE preference page with default argument specified">
</p>
</td>
</tr>
<tr>
<td width="20%" valign="top" align="left"><b>Stop in main</b></td>
<td width="80%" valign="top" align="left">
You can use <b>Stop in main </b>in a Java Application launch
configuration to cause your program to stop at the first executable
line of the main method when you run it under debug mode.
<p><img src="images/org.eclipse.jdt.debug.ui/stop_in_main.png" alt="Main tab with Stop in Main option selected">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Conditional breakpoints</b></td>
<td valign="top" align="left">You can use expressions to define conditional
breakpoints using the <b> Breakpoint Properties... </b> dialog or detail
pane in the breakpoints view. A condition controls when a breakpoint
actually halts execution. You can specify whether you want the
breakpoint to suspend execution only when the condition is true, or
when the condition value changes. The breakpoint condition editor
supports content assist.
<p><img src="images/org.eclipse.jdt.debug.ui/breakpoint_condition.png" alt="Breakpoint condition editor in breakpoint properties dialog or breakpoint detail pane"></p>
</td>
</tr>
<tr>
<td valign="top" align="left"><img src="images/new.png" alt=""><b>Triggers for breakpoints</b></td>
<td valign="top" align="left">
You can define a set of triggers for the breakpoints in a workspace.
<p>
<img src="images/trigger-breakpoint-properties.png" alt="">
</p>
Any breakpoint can be set as a trigger point by using <b>Breakpoint Properties...</b> dialog or the <b>Breakpoints</b> view's detail pane.
<p>
<img src="images/trigger-breakpoint-view-ruler.png" alt="">
</p>
Triggers are rendered with an overlay of "T" and the breakpoints suppressed by the triggers are
rendered with an overlay of "T" with a cut.
<p>
All the other breakpoints that are initially suppressed by triggers will be hit only after any of the trigger points has been hit.
All the triggers are disabled after a trigger point is hit and will be re-enabled after the run.
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><img src="images/new.png" alt=""><b>Debugging by writing to console via Tracepoint</b></td>
<td valign="top" align="left">
You can avoid inserting <code>System.out.println()</code> statements in your code for debugging by using tracepoints to print to the Console view.
To do so, add a tracepoint via <b>Run &gt; Toggle Tracepoint</b>.
<p>
<img src="images/toggle-trace-point-run.png" alt="">
</p>
It creates a conditional breakpoint using the "systrace" template with <b>Suspend when 'true'</b> option.
<p>
<img src="images/toggle-trace-point-conditional-breakpoint.png" alt="">
</p>
Since the condition doesn't explicitly return a boolean <code>true</code>, the condition is considered to implicitly return <code>false</code>,
and the breakpoint will not suspend the execution.
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Disabling breakpoints</b></td>
<td valign="top" align="left">
If you find yourself frequently adding and removing a breakpoint
in the same place, consider disabling the breakpoint when you don't
need it and enabling it when needed again. This can be done using <b>Disable
Breakpoint </b>in the breakpoint context menu or by unchecking the
breakpoint in the <b>Breakpoints view</b>.
<p>You can also temporarily disable all breakpoints using the <b>Skip
All Breakpoints (Ctrl+Alt+B)</b> action in the <b>Breakpoints view</b> toolbar.
This will tell the debugger to skip all breakpoints while maintaining
their current enabled state.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/breakpoint_menu.png" alt="Disable Breakpoint action in the ruler context menu"></p>
</td>
</tr>
<tr id="toggle-bp-mod-keys">
<td valign="top" align="left"><b>Toggle breakpoint modifier keys</b></td>
<td valign="top" align="left">
Use modifier keys while toggling breakpoints in the Java editor:
<ul>
<li><p>Holding the <b>Ctrl</b> key while double-clicking (toggling) a breakpoint will cause the <b>Properties
dialog</b> for that breakpoint to be displayed (on the Mac, use <b>Command</b>)</p>
</li>
<li>Holding the <b>Shift</b> key while double-clicking (toggling) a breakpoint will <b>enable / disable</b> that breakpoint</li>
</ul>
If there is no existing breakpoint, a normal breakpoint toggle takes place even if a modifier key is held down.
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Changing variable values</b></td>
<td valign="top" align="left">
When a thread is suspended in the debugger, you can change the values
of Java primitives and Strings in the <b>Variables</b> view. From the
variable's context menu, choose <b>Change Variable Value</b>. You can
also change the value by typing a new value into the Details pane and
using the <strong>Assign Value </strong>action in the context menu (<b>CTRL+S</b>
key binding).
<p><img src="images/org.eclipse.jdt.debug.ui/assign_value.png" alt="Change variable value from detail pane">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Variable values in hover help</b></td>
<td valign="top" align="left">When a thread is suspended and the
cursor is placed over a variable in the Java editor, the value of
that variable is displayed as hover help.
<p><img src="images/org.eclipse.jdt.debug.ui/variable_hover.png" alt="Variable value hover in the editor">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Drop to frame</b></td>
<td valign="top" align="left">
When stepping through your code, you might occasionally step too
far, or step over a line you meant to step into. Rather than
restarting your debug session, you can use the <b>Drop to Frame</b>
action to quickly go back to the beginning of a method. Select the
stack frame corresponding to the Java method you wish to restart, and
select <b>Drop to Frame</b> from <b>Debug view</b> toolbar or the
stack frame's context menu. The current instruction pointer will be
reset to the first executable statement in the method. This works for
non-top stack frames as well.
<p>Note that Drop to frame is only available when debugging with a
1.4 or higher VM, or the J9 VM. There are some situations where a JVM
may be unable to pop the desired frames from the stack. For example,
it is generally impossible to drop to the bottom frame of the stack
or to any frame below a native method.</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Hot code replace</b></td>
<td valign="top" align="left">The debugger supports Hot Code Replace when
debugging with a 1.4 or higher VM, or the J9 VM. This lets you make changes
to code you are currently debugging. Note that some changes such as new
or deleted methods, class variables or inner classes cannot be hot swapped,
depending on the support provided by a particular VM.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Stepping into selections and hyperlink
debugging </b></td>
<td valign="top" align="left">
The Java debugger allows you to step into a single method within a
series of chained or nested method calls. Simply select the method
you wish to step into and select <b>Step into Selection</b> from the
Java editor context menu.
<p>This feature works in places other than the currently executing
line. Try debugging to a breakpoint and step into a method a few
lines below the current instruction pointer.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/step_into_selection.png"
alt="Stepping into selection"></p>
<p>When the caret is not in a method name, the feature steps into the next method on the selected line.
For example, when the caret is at the beginning of the line<br>
<code>&nbsp;&nbsp;&nbsp;&nbsp;assertTrue(fFull.size() == 100)</code>,<br>
then <b>Step into Selection</b> steps into <code>assertTrue(..)</code>
(unlike <b>Step Into</b>, which would step into <code>size()</code>).</p>
<p>You can also step into a method by using hyperlink navigation. Simply
place the cursor over the method you wish to step into and use <strong>Ctrl+Alt+Click</strong>
to step into the method (rather than <strong>Ctrl+Click</strong> which
will navigate to the source code).</p>
<p><img src="images/org.eclipse.jdt.debug.ui/hyperlink_step.png" alt="Use Ctrl+Alt+Click to step into a method hyperlink"></p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Console pin and lock</b></td>
<td valign="top" align="left">Output displayed in the console can be locked
to a specific process via the <strong>Pin Console</strong> action in the
Console view toolbar. There's also a <strong>Scroll Lock </strong>action
that stops the console from scrolling as new output is appended.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Creating watch items</b></td>
<td valign="top" align="left">A watch item is an expression in the <b>Expressions</b>
view whose value is updated as you debug. You can create watch items from
the Java editor by selecting an expression or variable and choosing <b>Watch</b>
from its context menu or the top-level <b>Run</b> menu.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Watch points</b></td>
<td valign="top" align="left">
A watch point is a breakpoint that suspends execution whenever a specified
field is accessed or modified. To set a watchpoint, select a field in
the Outline view and choose <b>Toggle Watchpoint</b> from its context
menu. To configure a watchpoint, select the watchpoint in the <b>Breakpoints</b>
view and choose <b>Properties...</b> from its context menu. The most
important properties for this type of breakpoint are the <b>Access</b>
and <b>Modification</b> checkboxes which control when the breakpoint
can suspend execution. You can also set a condition for the watch point,
where the old value of the field can be used as part of the condition.
<p><img src="images/org.eclipse.jdt.debug.ui/watchpoint_condition.png" alt="">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Class load breakpoints</b></td>
<td valign="top" align="left">
A class load breakpoint suspends execution when a specified
class is loaded in the virtual machine. To set a class load breakpoint, select a class in
the Outline view and choose <b>Toggle Class Load Breakpoint</b> from its context
menu. You can also use the <b>Run &gt; Add Class Load Breakpoint...</b> menu action to create
a class load breakpoint.
<p><img src="images/org.eclipse.jdt.debug.ui/class-load-breakpoint.png" alt="Class load breakpoints suspend execution when a specified class is loaded">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Method breakpoints</b></td>
<td valign="top" align="left">
A method breakpoint suspends execution when a specific method is entered or exited.
To set a method breakpoint, select a method in
the Outline view and choose <b>Toggle Method Breakpoint</b> from its context
menu. Alternatively, double click on a method declaration line in the editor ruler
or use the <b>Run &gt; Toggle Method Breakpoint</b> menu action to create
a method breakpoint in the currently selected method.
<p>By default a method breakpoint
only suspends execution when a method is entered. You can use the breakpoint detail
pane or the breakpoint properties dialog to configure the breakpoint to suspend
on exit. Method breakpoints also support conditions.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/method-breakpoint.png" alt="Method breakpoints suspend execution when a specific method is entered or exited">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Threads and monitors</b></td>
<td valign="top" align="left">
The Java debugger optionally displays monitor information
in the <b>Debug</b> view. Use the <b>Show Monitors</b> action in the
Debug view drop down menu to show which threads are holding locks and
which are waiting to acquire locks. Threads involved in a deadlock
are rendered in red.
<p><img src="images/org.eclipse.jdt.debug.ui/deadlock.png"
alt="Debug view showing deadlock cycles"></p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Step filters</b></td>
<td valign="top" align="left">Step filters prevent the debugger from suspending
in specified classes and packages when stepping into code. Step filters
are established with the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.JavaStepFilterPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Step Filtering preference page">
<b>Java &gt; Debug &gt; Step Filtering</b></a> preference page.
When the <b>Use Step Filters</b> toggle (on the debug
toolbar and menu) is on, step filters are applied to all step actions. In
the Debug view, the selected stack frame's package or declaring type can
be quickly added to the list of filters by selecting <b>Filter Type</b>
or <b>Filter Package</b> from the stack frame's context menu.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Using the scrapbook</b></td>
<td valign="top" align="left">
If you want to experiment with API or test out a new algorithm, it's
frequently easier to use a Java scrapbook page than create a new class.
A scrapbook page is a container for random snippets of code that you can
execute at any time without a context. To create a scrapbook page, create
a new file with a <strong>.jpage</strong> extension (or use the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.newWizard(newWizardId=org.eclipse.jdt.debug.ui.snippetEditor.NewSnippetFileCreationWizard)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the New Scrapbook wizard">
<b>New Scrapbook Page</b></a> wizard).
Enter whatever code you wish to execute and then select it. There are three
ways to execute your code:
<ul>
<li>Execute the selected code and place the returned result in an inspect
popup</li>
<li>Execute the selected code and place the String result right in
the scrapbook page
<p><img src="images/org.eclipse.jdt.debug.ui/scrapbook.png" alt="Scrapbook page displaying result">
</p>
</li>
<li>Execute the selected code (and ignore any returned result)</li>
</ul>
<p>These actions are in the workbench toolbar and also in the
scrapbook page's context menu.</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Editing<br>
launch<br>
configurations</b></td>
<td valign="top" align="left">Holding down the <b>Ctrl</b> key and
making a selection from the <b>Run</b> or <b>Debug</b> drop-down menu
opens the associated launch configuration for editing. The launch
configuration can also be opened from the context menu associated
with any item in the Debug view.</td>
</tr>
<tr>
<td valign="top" align="left"><b>Favorite launch configurations</b></td>
<td valign="top" align="left">
Launch configurations appear in the Run/Debug drop-down menus in most
recently launched order. However it is possible to force a launch configuration
to always appear at the top of the drop-downs by making the configuration
a 'favorite'. Use the <strong>Organize Favorites...</strong> action from
the appropriate drop down menu to configure your favorite launch configurations.
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Detail formatters</b></td>
<td valign="top" align="left">
In the <b>Variables</b> &amp; <b>Expressions</b> views, the detail
pane shows an expanded representation of the currently selected
variable. By default, this expanded representation is the result of
calling <code>toString()</code> on the selected object, but you can create
a custom detail formatter that will be used instead by choosing <b>New
Detail Formatter</b> from the variable's context menu. This detail
formatter will be used for all objects of the same type. You can view
and edit all detail formatters in the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.JavaDetailFormattersPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Detail Formatters preference page">
<b>Java &gt; Debug &gt; Detail Formatters</b></a> preference page.
<p><img src="images/org.eclipse.jdt.debug.ui/detail_formatter.png" alt="Detail formatter dialog">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Running code with compile errors</b></td>
<td valign="top" align="left">
You can run and debug code that did not compile cleanly. The only
difference between running code with and without compile errors is
that if a line of code with a compile error is executed, one of two
things will happen:
<ul>
<li>If the 'Suspend execution on compilation errors' preference on the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.debug.ui.JavaDebugPreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png" alt="Opens the Debug preference page">
<b>Java &gt; Debug</b></a> preference page is set and you are
debugging, the debug session will suspend as if a breakpoint had
been hit. Note that if your VM supports Hot Code Replace, you could
then fix the compilation error and resume debugging</li>
<li>Otherwise, execution will terminate with a 'unresolved
compilation' error</li>
</ul>
<p>It is important to emphasize that as long as your execution path
avoids lines of code with compile errors, you can run and debug just
as you normally do.</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Word wrap in Variables view</b></td>
<td valign="top" align="left">The details area of the debugger's <b>Variables</b>
and <b>Expressions</b> views supports word wrap, available from the
view drop-down menu.
<p><img src="images/org.eclipse.jdt.debug.ui/word_wrap.png" alt="Word wrap action in Variables view drop-down menu">
</p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Code assist in the debugger</b></td>
<td valign="top" align="left">
Code assist is available in many contexts beyond writing code in
the Java editor:
<ul>
<li>When entering a <b>breakpoint condition</b></li>
<li>In the <b>Details</b> pane of the <b>Variables</b> &amp; <b>Expressions</b>
view</li>
<li>When entering a <b>Detail Formatter</b> code snippet</li>
<li>When entering a <b>Logical Structure</b> code snippet</li>
<li>When entering code in a <b>Scrapbook</b> page</li>
<li>In the <b>Display</b> view</li>
</ul>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Command line details</b></td>
<td valign="top" align="left">You can always see the exact command
line used to launch a program in run or debug mode by selecting <b>Properties</b>
from the context menu of a process or debug target, even if the
launch has terminated.
<p><img src="images/org.eclipse.jdt.debug.ui/process_properties.png" alt="Command line details"></p>
</td>
</tr>
<tr>
<td valign="top" align="left"><b>Stack trace<br>
hyperlinks</b></td>
<td valign="top" align="left"> Java stack traces in the console appear with hyperlinks. When you place
the mouse over a line in a stack trace the pointer changes to the hand.
Pressing the mouse button opens the
associated Java source file and positions the cursor at the corresponding
line. Pressing the mouse button on the exception name at the top of the
stack trace will create an exception breakpoint.
<p><img src="images/org.eclipse.jdt.debug.ui/stack_trace.png" alt="Stack traces in Console view with hyperlinks"> </p></td>
</tr>
<tr>
<td valign="top" align="left"><b>Debugging in the Java perspective </b></td>
<td valign="top" align="left">
You can debug in the Java perspective by configuring the <strong>Run/Debug &gt; View Management</strong> preferences. Select the perspectives you want to be debug from.
<p><img src="images/org.eclipse.jdt.debug.ui/view-mngmt.png" alt="View Management preference page"></p>
<p>Ensure the preference to activate the debug view when a breakpoint is hit is turned on (via the top level <strong>Run/Debug</strong> preference page).</p>
<p><img src="images/org.eclipse.jdt.debug.ui/activate-debug-view.png" alt="Run/Debug preference page" > </p>
<p>You can disable the perspective switching prompt on the <strong>Run/Debug &gt; Perspectives</strong> preference page. With these settings the Debug view will automatically open in the Java perspective when a breakpoint is hit. </p>
<p><img src="images/org.eclipse.jdt.debug.ui/perspective-prompt.png" alt="Perspectives preference page" > </p>
<p>By placing the Debug view at the top of the perspective and resizing its height to the size of one element, the view will switch to a bread crumb presentation. This minimizes the amount of screen space the view consumes.</p>
<p><img src="images/org.eclipse.jdt.debug.ui/dbg-bread-crumb.png" alt="Debug view in bread crumb mode" ></p></td>
</tr>
</tbody>
</table>
</body>
</html>