| <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" |
| "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> |
| <html lang="en" xmlns="http://www.w3.org/1999/xhtml" xml:lang="en"> |
| <head> |
| <meta name="copyright" content= |
| "Copyright (c) IBM Corporation and others 2000, 2014. 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=utf-8" /> |
| <meta http-equiv="Content-Style-Type" content="text/css" /> |
| <title> |
| Organizing import statements |
| </title> |
| <script language="JavaScript" type="text/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>By default, import declarations are hidden in the Outline view. |
| Select <strong>View Menu > Filters...</strong> and un-check <strong>Import declarations</strong>. |
| Click <strong>OK</strong> to make them visible in the Outline view. |
| </li> |
| <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 |
| compile 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.svg" 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> |
| |
| <h3 class="related">Related concepts</h3> |
| <a href="../concepts/concept-java-editor.htm">Java editor</a><br /> |
| |
| <h3 class="related">Related references</h3> |
| <a href= |
| "../reference/preferences/java/codestyle/ref-preferences-organize-imports.htm"> |
| Organize Imports Preferences</a><br /> |
| </body> |
| </html> |