# Dialog based refactoring user interface

A dialog based user interface guides you through the steps necessary to execute a selected refactoring. A dialog based refactoring user interface consists of a short first dialog gathering information that is required to execute the refactoring, a separate problem dialog that pops up if any errors are detected and a preview dialog to preview the results of a refactoring.

## Input dialog

This dialog gathers information that is required for the refactoring. For example, for a rename refactoring you will enter the new name for the Java element. You can either press OK to execute the refactoring or Preview > to preview the result of the refactoring.

## Preview dialog

The JDT allows you to preview the results of a refactoring action before you execute it.

The preview dialog consists of two parts:

- A tree at the top containing all Java elements affected by the refactoring. Each top-level node in the tree represents one compilation unit.
- A compare viewer at the bottom. The left side of the compare viewer shows the original, the right side displays the refactored source.

## Problem dialog

The problem dialog indicates if there are suspected, potential, or definite problems with the refactoring action you are attempting.

Four types of problems are possible:

Information
  A problem described as Information will not affect the refactoring in any way, nor will it negatively affect the code in the workbench. You can most likely ignore this type of problem.
Warnings
  Warnings attempt to predict compiler warnings. This type of problem most likely will not negatively affect the code in your workbench.
Errors
  A problem described as an Error is very likely to cause compiler errors or change your workbench code semantically. You can choose to continue with the refactoring in spite of these errors, although it is not recommended.
Stop problems
  This type of problem prevents the refactoring from taking place. For example, if you select a comment and choose the Extract Method command from it, the workbench will issue a stop problem on the refactoring attempt because you cannot extract a comment.

If there aren't any stop problems then the refactoring can be carried out by pressing the OK button. To preview the results of the refactoring action, press the Continue button.

Refactoring support

Refactoring actions

Icons