EGL can automatically organize
the import statements
in your code.
Organizing import statements
involves reordering
and grouping the statements by the package name. Also, EGL removes
unnecessary import statements
from your code.
Follow these steps to set preferences for organizing
the
import statements
in your code:
- From the main menu, click .
- In the Preferences
window, expand and click Organize
Imports.
- On the Organize Imports page of the Preferences
window, set the order
for import statements in the list of package
names:
- To add a new package or prefix to the list, click New and
type the new name. You can use the asterisk character as a wild card
at the
end of the package name.
- To reorder the packages and prefixes,
click a package or prefix in the
list to select it and then click Up or Down.
- In the Number of imports needed field,
enter the
minimum number of individual import statements
in
the same package to simplify into an import statement
with a wild card character.
For example, your file might have the
following
similar
import statements:
import com.mypackage.myPart1;
import com.mypackage.myPart2;
import com.mypackage.myPart3;
If you set the
Number
of imports needed field to
3, the editor
will
simplify these
import statements into the
following
single
import statement:
import com.mypackage.*;
- Click Apply to save the changes and remain
in the
Preferences window. Click OK to save the changes
and
exit the window.
To organize your import statements,
open a source
file in the editor, right-click the file, and then click Organize
Imports. Alternatively, you can organize the import statements
for every file in a project or package by right-clicking the project
or package
in the Project Explorer view and then clicking Organize
Imports.