blob: edb7069dfbd2b5972d6981964accaf96317c9874 [file] [log] [blame]
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN">
<html>
<head>
<meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2005. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." >
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta http-equiv="Content-Style-Type" content="text/css">
<meta name="GENERATOR" content="Mozilla/4.75 [en] (Windows NT 5.0; U) [Netscape]">
<title>
Setting the order of import statements
</title>
<link rel="stylesheet" href="../book.css" charset="ISO-8859-1" type="text/css">
<script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script>
</head>
<body>
<h1>
Setting the order of import statements
</h1>
<ol>
<li>
Open the
<a class="command-link" href='javascript:executeCommand("org.eclipse.ui.window.preferences(preferencePageId=org.eclipse.jdt.ui.preferences.ImportOrganizePreferencePage)")'>
<img src="PLUGINS_ROOT/org.eclipse.help/command_link.png">
<strong>Java &gt; Code Style &gt; Organize Imports</strong></a> preference page.
</li>
<li>
The <strong>Organize Imports</strong> page defines the sorting order of import statements.
In the Imports list, manage the list of package prefixes as follows:
<ul>
<li>
<strong>New</strong> to add a new prefix
</li>
<li>
<strong>New Static</strong> to add a new prefix for static imports (J2SE 5.0 only)
</li>
<li>
<strong>Edit</strong> to change the name of an existing prefix
</li>
<li>
Use <strong>Up</strong> and <strong>Down</strong> buttons to rearrange the sequence
of the list by moving the selected prefix up or down
</li>
<li>
<strong>Remove</strong> to remove the selected prefix from the list
</li>
<li>
Use <strong>Import...</strong> and <strong>Export...</strong> to load a list of prefixes from a file
or to store it to a file
</li>
</ul>
</li>
<li>
In the <strong>Number of imports needed before .*</strong> field,
type the number of import statements that are allowed to refer to the
same package before <em>&lt;package prefix&gt;.*</em> is used.
This number is called the import threshold.
</li>
<li>
Click <strong>OK</strong> when you are done.
</li>
</ol>
<p>
<strong>Note:</strong> The order of import statements can also be configured per project:
</p>
<ol>
<li>
Select a java project, open the pop-up menu and choose <strong>Properties</strong>.
</li>
<li>
Select the <strong>Code Style &gt; Organize Imports</strong> page and check <strong>Enable project specific sttings</strong>.
</li>
<li>
Manage the list as explained above.
</li>
<li>
Click <strong>OK</strong> when you are done.
</li>
</ol>
<p>
<img src="../images/ngrelc.png" alt="Related concepts" border="0" >
</p>
<p>
<a href="../concepts/concepts-7.htm">Java editor</a>
</p>
<p>
<img src="../images/ngrelt.png" alt="Related tasks" border="0" >
</p>
<p>
<a href="tasks-59.htm">Adding required import statements</a><br>
<a href="tasks-58.htm">Managing import statements</a><br>
<a href="tasks-60.htm">Organizing existing import statements</a>
</p>
<p>
<img src="../images/ngrelr.png" alt="Related reference" border="0" >
</p>
<p>
<a href="../reference/ref-menu-refactor.htm">Refactoring actions</a><br>
<a href="../reference/ref-22.htm">Organize Import preference page</a>
</p>
</body>
</html>