Setting preferences for organizing import statements in the EGL editor

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.

To set preferences for organizing the import statements in your code:
  1. From the main menu, click Window > Preferences.
  2. In the Preferences window, expand EGL > Editor and click Organize Imports.
  3. 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 and then click Up or Down.
  4. 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 simplifies these import statements into the following import statement:
    import com.mypackage.*;
  5. To save your changes and remain in the Preferences window, click Apply. To save the changes and exit the window, click OK.

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.


Feedback