Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Eclipse Java Development User Guide
Previous Page Home Next Page

Using content assist

In this section you will use content assist to finish writing a new method. Open the file junit.samples/VectorTest.java in the Java editor if you do not already have it open and select the testSizeIsThree() method in the Outline view. If the file doesn't contain such a method see Adding new methods for instructions on how to add this method.

  1. Replace the TODO comment with the following lines.

    assertTrue(fFull.size() == 3);
    Vector v = new Vector();
    for (int i=0; i<3; i++)
      v.addElement(new Object());
    assert

  2. With your cursor at the end of the word assert, press Ctrl+Space to activate content assist. The content assist window with a list of proposals will appear. Scroll the list to see the available choices.

    Content assist

  3. With the content assist window still active, type the letter 't' in the source code after assert (with no space in between). The list is narrowed and only shows entries starting with 'assert'. Single-click various items in the list to view any available Javadoc help for each item.

    Content assist filtered

  4. Select assertTrue(boolean) from the list and press Enter. The code for the assertTrue(boolean) method is inserted.
  5. Complete the line so that it reads as follows:

    assertTrue(v.size() == fFull.size());

  6. Save the file.

Related concepts

Java editor

Related reference

Java Content Assist
Java Editor Preferences


 
 
  Published under the terms of the Eclipse Public License Version 1.0 ("EPL") Design by Interspire