Safe delete
Aqua lets you use the Safe Delete refactoring to remove files and symbols from the source code safely. Before Aqua deletes a file or a symbol, it searches for usages and if they are found, Aqua lets you check them to make necessary adjustments.
Safe delete
Select an item you want to delete.
Select
from the main or context menu or press Alt+Delete.In the dialog that opens, select necessary options and click OK.
The available options are:
Search in comments and strings :If this checkbox is selected, Aqua will look for occurrences within comments and string literals in your source code files.
Search for text occurrences :If this checkbox is selected, Aqua will look for occurrences in files that don't contain source code. These may be the text files, properties files, HTML files, documentation files, and so on.
If Aqua encountered potential problems, it displays the Usages Detected dialog. Proceed with the appropriate action.
Examples
Safe delete a parameter
Safe delete a parameter for a call hierarchy (here performed on the parameter i
within baz(int i)
).
If a parameter is passed only through a call hierarchy, the Safe Delete action will delete the parameter through the whole hierarchy. Aqua displays the appropriate dialog where you can select the caller methods in which the parameter should be deleted.
Safe delete a method
Safe delete a method in a call hierarchy (here performed on the foo(int i)
method).
Aqua analyzes the corresponding call hierarchy and displays the appropriate dialog, suggesting you delete all unused methods in that call hierarchy.
Safe delete the unused class field
Safe delete the unused class field (here performed on myProperty
).
When you remove an unused class field that is injected via constructor, Aqua removes the associated constructor parameter as well. Aqua opens the appropriate dialog where you can check and confirm your code deletion.