Adding Required Import Statements

The Java editor can help you add required import statements for a selected type inside a compilation unit.

1.

Select a type in your Java code, and do one of the following:

  • Select Add Import from the context menu in the editor
  • Select Edit > Add Import from the menu bar.
  • Press Ctrl+Shift+M

2.

Either the editor can identify the type or you are prompted to choose the desired type from a list of possible types.

3.

The import statement is generated and inserted as specified by the import order preference.

See Setting the Order of Import Statements