Setting preferences for organizing import statements in the EGL editor

EGL can automatically organize the import statements in your code. The process orders and groups those statements by package name and removes unnecessary import statements.

Do as follows:

  1. From the main menu, click Window > Preferences. The Preferences window is displayed.
  2. In the Preferences window, expand EGL > Editor and click Organize Imports. The Organize Imports pane is displayed.
  3. On the Organize Imports pane of the Preferences window, set the order for import statements in the list of package names:
    • To add a new import statement (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 edit an import statement, select the name of the package or prefix name and click Edit.
    • To remove an import statement from the import list, select the name of the package or prefix and click Remove.
    • To reorder the import statements, click a package or prefix in the list to select it and then click Up or Down.
    • To import an import statement, click Import and specify the XML file that contains the import statement to be imported.
    • To export an import statement, click Export and specify the location and name of the XML file to contain the import statement.
  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 will simplify these import statements into the following single import statement:
    import com.mypackage.*;
  5. To save the 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.