Refactoring in the DVT Eclipse IDE - How to Perform Filename Refactoring

Overview

DVT helps you refactor the name of a file, by making sure that it is also replaced in all the places where it is references, be it `include directives or build configuration files. This video also shows how you can easily stick with a naming convention where the top element must match the filename, even after rename refactor.

Explore the design and verification tools: https://www.dvteclipse.com
Or request a license: https://www.dvteclipse.com/request-license

Details

Renaming a File in Project Explorer

To change the name of a file:

  1. Right-click on it in the Project Explorer View.
  2. Select Rename or press F2.
  3. Fill in the new name.
  4. Click Preview to inspect the changes about to be performed.
  5. Note that, along with the file name, all the places where it's included, as well as the project's build configuration, are updated accordingly.
  6. Press OK when done.

Alternative Method: Renaming from the Editor

To trigger the rename operation, right-click in the editor and choose Refactor > Rename File.

Renaming from an Include Directive

In specific situations, it might be more convenient to start from an include directive. It often happens that the name of a file coincides with the name of the class, module, interface, etc. defined within the file. In such cases, for example when renaming a class, note that the tool proposes to also update the file name in accordance.