- Opening the Source Editor
- Managing Automatic Insertion of Closing Characters
- Displaying Line Numbers
- Generating Code Snippets without Leaving the Keyboard
- Using Code Completion
- Inserting Snippets from Code Templates
- Using Editor Hints to Generate Missing Code
- Matching Other Words in a File
- Generating Methods to Implement and Override
- Generating JavaBeans Component Code
- Creating and Using Macros
- Creating and Customizing File Templates
- Handling Imports
- Displaying Javadoc Documentation While Editing
- Formatting Code
- Text Selection Shortcuts
- Navigating within the Current Java File
- Navigating from the Source Editor
- Searching and Replacing
- Deleting Code Safely
- Changing a Method's Signature
- Encapsulating a Field
- Moving a Class to a Different Package
- Moving Class Members to Other Classes
- Creating a Method from Existing Statements
- Creating an Interface from Existing Methods
- Extracting a Superclass to Consolidate Common Methods
- Changing References to Use a Supertype
- Unnesting Classes
- Tracking Notes to Yourself in Your Code
- Comparing Differences Between Two Files
- Splitting the Source Editor
- Maximizing Space for the Source Editor
- Changing Source Editor Keyboard Shortcuts
Handling Imports
When you use the IDE's code completion and editor hints features, import statements are generated for you automatically.
For example, if you have the code completion box open and you start typing a simple class name instead of its fully-qualified class name (e.g., you type Con and then select ConcurrentHashMap from the code completion box), the following import statement will be added to the beginning of the file:
import java.util.concurrent.ConcurrentHashMap;
For cases where these mechanisms are not sufficient for the management of import statements, you can use the following commands:
- Fix Imports (Alt-Shift-F), which automatically inserts any missing import statements for the whole file. Import statements are generated by class (rather than by package). For rapid management of your imports, use this command.
- Fast Import (Alt-Shift-I), which enables you to add an import statement or generate the fully qualified class name for the currently selected identifier. This command is useful if you want to generate an import statement for a whole package or if you want to use a fully qualified class name inline instead of an import statement.