Organizing import statements
In this section you will organize the import declarations in your source
code. Open junit.samples/VectorTest.java file in the Java
editor if you do not already have it open.
- By default, import declarations are hidden in the Outline view.
Select View Menu > Filters... and un-check Import declarations.
Click OK to make them visible in the Outline view.
- Delete the import declarations by selecting them in the Outline view
and selecting Delete from the context menu. Confirm the
resulting dialog with Yes. You will see numerous
compile warnings in the vertical ruler since the types used in the
method are no longer imported.
- From the context menu in the editor, select Source >
Organize Imports. The required import statements are added to
the beginning of your code below the package declaration.
You can also choose Organize Imports from the
context menu of the import declarations in the Outline view.
Note: You can specify the order of the import declarations using the
Java > Code
Style > Organize Imports preference page.
- Save the file.
Java editor
Organize Imports Preferences