FeaturesPluginsDocs & SupportCommunityPartners

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

  1. 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

  1. Search in comments

Fast Parameters Check

  1. No

Parameters Check

  1. No

Changes To Be Made

  1. 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]|
-----------------------------------------------------------
  1. [ ] Preview All Changes will not be checked by default.
  2. [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.
Companion
Projects:
MySQL Database Server   Open JDK: an Open SourceJDK   GlassFish Community: an Open Source Application Server    Mobile & Embedded Community    Open Solaris   java.net - The Source for Java Technology Collaboration   Virtual Box - full virtualizer  Open ESB - The Open Enterprise Service Bus Powered by