| <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0//EN"> |
| <html> |
| <head> |
| <meta name="copyright" content="Copyright (c) IBM Corporation and others 2000, 2007. This page is made available under license. For full details see the LEGAL in the documentation book that contains this page." > |
| <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"> |
| <title> |
| Organizing import statements |
| </title> |
| <script language="JavaScript" src="PLUGINS_ROOT/org.eclipse.help/livehelp.js"> </script> |
| </head> |
| <body> |
| <h1> |
| Organizing import statements |
| </h1> |
| <p> |
| In this section you will organize the import declarations in your |
| source code. 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/view_outline_delete_import.png" alt="Outline view context menu"> |
| </p> |
| </li> |
| <li> |
| From the context menu in the editor, select <strong>Source > Organize Imports</strong>. The required import statements are added to the beginning of your code below the package |
| declaration. |
| <p> |
| <img src="images/editor_vectortest_organized_imports.png" 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 using 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" alt="Goto the organize imports preference page"> |
| <strong>Java > Code Style > Organize Imports</strong></a> |
| preference page. |
| </li> |
| <li> |
| Save the file. |
| </li> |
| </ol> |
| <P class="nav_footer" id="nav_footer">Next Section: <A href="qs-LocalHistory.htm">Using the local history</A> |
| </P> |
| <p> |
| <img border="0" src="../images/ngrelc.png" alt="Related concepts" > |
| </p> |
| <p> |
| <a href="../concepts/concepts-7.htm">Java editor</a><br> |
| </p> |
| <p> |
| <img src="../images/ngrelr.png" alt="Related reference"> |
| </p> |
| <p> |
| <a href="../reference/ref-22.htm">Organize Imports Preferences</a><br> |
| </p> |
| |
| </body> |
| </html> |
| |