blob: 605b950d8db610c92235f01872126f447e27a7dc [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>
Using content assist
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
</head>
<body>
<h1>
Using content assist
</h1>
<p>
In this section you will use <em>content assist</em> to finish writing a new
method. Open <em>junit.samples.VectorTest.java</em> file in the Java
editor if you do not already have it open and select the <code>testSizeIsThree()</code> method
in the Outline view. If the file doesn't contain such a method see <a href="qs-AddMethod.htm">Adding new methods</a>
for instructions on how to add this method.
</p>
<ol>
<li>
Add the following lines to the end of the method:
<p>
<code>
Vector v = new Vector();<br>
for (int i=0; i&lt;3; i++)<br>
&nbsp;&nbsp;v.addElement(new Object());<br>
assert<br>
</code>
</p>
</li>
<li>
With your cursor at the end of the word <code>assert</code>, press <kbd>Ctrl</kbd>+<kbd>Space</kbd> to activate content assist. The content assist window with a list of
proposals will appear. Scroll the list to see the available choices.
<p>
<img src="../images/qs-16.gif" width=453 height=253 alt="Content assist">
</p>
</li>
<li>
With the content assist window still active, type the letter 't'
in the source code after <code>assert</code> (with no space in between). The list is narrowed and only shows entries
starting with 'assertt'. Select and then hover over various items in the list to view any available Javadoc help for each item.
<p>
<img src="../images/qs-17.gif" width=453 height=186 alt="Content assist filtered">
</p>
</li>
<li>
Select <code>assertTrue(boolean)</code> from the list and press <kbd>Enter</kbd>. The code for the <code>assertTrue(boolean)</code> method is inserted.
</li>
<li>
Complete the line so that it reads as follows:<br>
<p><code>
assertTrue(v.size() == fFull.size());
</code></p>
</li>
<li>
Save the file.
</li>
</ol>
<p>
<img border="0" src="../images/ngrelc.gif" alt="Related concepts" width="159" height="27">
</p>
<p>
<a href="../concepts/concepts-7.htm">Java editor</a><br>
</p>
<p>
<img src="../images/ngrelt.gif" alt="Related tasks" border="0" height="27" width="159">
</p>
<p>
<a href="../tasks/tasks-54.htm">Using the Java editor</a><br>
<a href="../tasks/tasks-65.htm">Using content assist</a><br>
</p>
<p>
<img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference">
</p>
<p>
<a href="../reference/ref-143.htm">Java Content Assist</a><br>
<a href="../reference/ref-21.htm">Java Editor Preferences</a><br>
</p>
<p>
<a href="../hglegal2003.htm"><img src="../images/ngibmcpy2003.gif" width=324 height=14 alt="Copyright (c) 2000, 2003 IBM Corporation and others. All Rights Reserved." border="0"></a>
</p>
</body>
</html>