blob: 03a259da5a907280bfcbe060719907e56d7f3038 [file]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<title>
Organizing Import Statements
</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>
Organizing import statements
</h1>
<p>
In this section you will organize the import declarations in your
source code.&nbsp; Open <em>junit.samples.VectorTest.java</em> file in the Java
editor if you do not already have it open.
</p>
<ol>
<li>
Delete the import declarations by selecting them in the Outline view and selecting
<strong>Delete</strong> from the context menu. Confirm the resulting dialog with
<strong>Yes</strong>.
You will see numerous compiler warnings in the vertical ruler since the
types used in the method are no longer imported.
<p>
<img src="../images/qs-18.gif" width=206 height=313 alt="Outline view context menu">
</p>
</li>
<li>
From the context menu in the editor, select <strong>Source &gt; Organize Imports</strong>. The required import statements are added to the beginning of your code below the package
declaration.
<p>
<img src="../images/qs-19.gif" width=466 height=277 alt="Organize imports">
</p>
You can also choose <strong>Organize Imports</strong> from the context menu of the
import declarations in the Outline view.<br>
Note: You can specify the order of the import declarations
in preferences <strong>Window &gt; Preferences &gt; Java &gt; Organize Imports</strong>.
</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-58.htm">Managing import statements</a><br>
</p>
<p>
<img src="../images/ngrelr.gif" width=159 height=27 alt="Related reference">
</p>
<p>
<a href="../reference/ref-22.htm">Organize Imports 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>