IntelliJ IDEA 2020.2 Help

Rename dialog for a directory

Use this dialog to rename a directory.

In addition to renaming the directory itself, IntelliJ IDEA can also look for the usages of the directory name. If found, the changes you are making to the directory name can also be applied to these usages.

The usages are assigned to different categories which correspond to the options which you can turn on and off.

You can set up a scope for usages of a class where the renaming method is located. For example, it might be helpful if you want to rename some popular method such as getSomething. Instead of searching through the whole project and deciding what to rename or what to leave unchanged along the way, you can limit your search to just one file, or just open files, or the recently changed files, and so on.

ItemDescription
Rename <directory> and its usages toSpecify a new name for the directory.
Search for references

If this option is on, IntelliJ IDEA will look for occurrences of the directory name in directory references in source code files.

Whether or not a string literal is a reference is defined by the (programming) language used in a source file.

Search in comments and stringsIf this checkbox is selected, IntelliJ IDEA will look for occurrences of the directory name within comments and string literals in your source code files.
Search in loaded sourcesIf this checkbox is selected, IntelliJ IDEA will look for occurrences of the directory name within downloaded object sources.
SQL ScriptThe statement to be run to rename the table or column. If necessary, you can edit the statement right in this pane.
RefactorExecute the statement and make associated changes right away.
PreviewPreview potential associated changes prior to executing the statement.
Search for text occurrencesIf this option is on, IntelliJ IDEA will look for occurrences of the directory name in the files that don't contain source code. These may be the text files, properties files, HTML files, documentation files, and so on.
Rename variables

If this option is on, IntelliJ IDEA will look for occurrences of the directory name in the names of variables. Note that only the variables that have the type of the directory you are renaming will be taken into account.

To illustrate, let's assume that you are renaming the class MyClass and there are the variables MyClass myclass, MyClass myclass20, MyClass m and YourClass myclass25. In such a case, IntelliJ IDEA will suggest to rename the first and the second of the variables but won't suggest to rename the third and the fourth.

Rename inheritors

If this option is on, IntelliJ IDEA will look for occurrences of the directory name in the names of its inheritors:

  • If you are renaming a class, IntelliJ IDEA will search the hierarchies of the classes that extend this class.

  • If you are renaming an interface, IntelliJ IDEA will search the hierarchies of the interfaces that extend this interface and the hierarchies of the classes that implement this interface.

Rename tests If this option is on, IntelliJ IDEA will look for occurrences of the class name in the names of the test classes.
Rename bound forms

This option is available if the class you are renaming has an associated GUI form.

Select this checkbox to rename the associated form.

ScopeUse this option to set a scope for the Rename refactoring. For example, you can limit the refactoring to only recently changed files, or to only open files, and so on. You can also create a custom scope that you can either share or keep local.
Last modified: 08 May 2020