Safe Delete Refactoring Specification
Author:
Jan Becicka CVS history
The Safe Delete refactoring function is useful if user needs to remove a class/method/field and check whether it is used.
Implementation of this refactoring is tracked in
issue 55276.
Pre-Conditions
- One or more classes/methods/fields are selected. Only one type of elements can be selected (Refactoring will not be available if e.g. a class and a field is selected at a time.).
Pre-Checks
Parameters
- Search in comments
Fast Parameters Check
- No
Parameters Check
- No
Changes To Be Made
- Selected classes/fields/methods are removed.
Checks During Changes Preparation
Elements which are selected will be checked whether they are referenced. If a method is selected, refactoring will also check, if this method overrides, is overriden by another method.
Refactoring UI
Menu item:
Safely Delete...
Action title:
Safely Delete - name
Parameters panel:
------------------------------------------
| Delete Class org.netbeans.test.Test |
| |
| [x] Search In Comments |
| |
------------------------------------------
Error Panel:
-----------------------------------------------------------
| The following errors were found. |
| You can continue only with warnings. |
| List of Errors |
| -------------------------------------------------------- |
||? Class Test has 23 occurences [Show details...] ||
|| Remove all references to class Test in order ||
|| to safely delete your class. ||
| -------------------------------------------------------- |
| ! - Error ? - Warning |
| |
| [ ] Preview All Changes [< Back] [Next >] [Cancel] [Help]|
-----------------------------------------------------------
- [ ] Preview All Changes will not be checked by default.
- [Show details...] will close refactoring wizard and open Find Usages window with tree of occurences of selected classes/fields/methods. There will be a button [Rerun Safe Delete] (in place where [Refactor] button resides in Refactoring window), which invokes Safe Delete again.