Refactoring actions

There are many different refactoring actions available in IntelliJ IDEA. Let's cover the important ones first: Rename, Copy, Move, and Safe Delete.

Rename

This is probably the most commonly used refactoring. The target for the rename action can be any symbol in the source code: class, method, field, method parameter, or local variable.

To rename, just pick the target and press Shift + F6. This action will start the in-place prompt, as shown in the following screenshot:

Rename

If you use the Shift + F6 shortcut twice, the Rename dialog box will offer additional options such as searching within comments and text strings, as shown here:

IntelliJ ...

Get IntelliJ IDEA Essentials now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.