If you need to rename a file, select one in the Project tool window. In the editor, select the element you want to rename. If you want to undo the changes you have made, press Ctrl+Z. IntelliJ IDEA opens the Rename dialog where you can enter the new package name and click Preview to see what directories and files will be affected before you decide to refactor. However, you can proceed with one of the offered options in the warning. If you have multiple directories that correspond to the package, or the package contains directories in the libraries that cannot be renamed, IntelliJ IDEA will display a warning. Right-click the package you want to rename and from the context menu, select Refactor | Rename ( Shift+F6). IntelliJ IDEA lists all the packages in your project. In the Project tool window, click Project and select Packages from the list. If you rename both module and directory at once, in the Rename dialog add the new name, check where to search for references and then click OK. In the Rename dialog that opens, type the new name, specify additional options and the scope of the refactoring, and click Refactor. If you have a module with one content root, and it has the same name as your module, you can rename them both simultaneously. In the popup that opens, select what you want to rename. In the Project tool window right-click a directory or a module that you want to rename.įrom the context menu, select Refactor | Rename ( Shift+F6). IntelliJ IDEA renames the code element and updates its usages accordingly. IntelliJ IDEA will display in the gutter.Ĭlick the gutter icon or press Alt+Enter and apply a suggestion. In the editor start renaming a parameter, a method, or other code element. The refactoring changes are displayed on the Refactoring Preview tab in the Find tool window. When you rename methods that are declared in interfaces, you can also review and rename their implementations as well. Preview potential changes before you refactor. Renaming classes or public methods could potentially impact a lot of files. Renaming local variables or private methods can be done easily inline since only the limited scope is affected. Use the Rename refactoring to change names of symbols, files, directories, packages, modules and all the references to them throughout code.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |