# Refactor actions

Refactor menu commands:

Name | Function | Keyboard Shortcut
Rename | Starts the Rename refactoring dialog: Renames the selected element and (if enabled) corrects all references to the elements (also in other files). Is available on methods, method parameters, fields, local variables, types, type parameters, enum constants, compilation units, packages, source folders, projects and on a text selection resolving to one of these element types. | Alt + Shift + R
Move | Starts the Move refactoring dialog: Moves the selected elements and (if enabled) corrects all references to the elements (also in other files). Can be applied to one instance method (which can be moved to a component), one or more static methods, static fields, types, compilation units, packages, source folders and projects and on a text selection resolving to one of these element types. | Alt + Shift + V
Change Method Signature | Starts the Change Method Signature refactoring dialog. Changes parameter names, parameter types, parameter order and updates all references to the corresponding method. Additionally, parameters can be removed or added and method return type as well as its visibility can be changed. This refactoring can be applied to methods or on text selection resolving to a method. |
Convert Anonymous Class to Nested | Start the Convert Anonymous Class to Nested Class refactoring dialog. Helps you convert an anonymous inner class to a member class. This refactoring can be applied to anonymous inner classes. |
Move Member Type to New File | Starts the Move Member Type to New File refactoring dialog. Creates a new Java compilation unit for the selected member type, updating all references as needed. For non-static member types, a field is added to allow access to the former enclosing instance, if necessary. This refactoring can be applied to member types or text resolving to a member type. |
Push Down | Starts the Push Down refactoring dialog. Moves a set of methods and fields from a class to its subclasses. This refactoring can be applied to one or more methods and fields declared in the same type or on a text selection inside a field or method. |
Pull Up | Starts the Pull Up refactoring wizard. Moves a field or method to a superclass of its declaring class or (in the case of methods) declares the method as abstract in the superclass. This refactoring can be applied on one or more methods, fields and member types declared in the same type or on a text selection inside a field, method or member type. |
Extract Interface | Starts the Extract Interface refactoring dialog. Creates a new interface with a set of methods and makes the selected class implement the interface, optionally changing references to the class to the new interface wherever possible. This refactoring can be applied to types. |
Generalize Type | Starts the Generalize Type refactoring dialog. Allows the user to choose a supertype of the reference's current type. If the reference can be safely changed to the new type, it is. This refactoring can be applied to type references and declarations of fields, local variables, and parameters with reference types. |
Use Supertype Where Possible | Starts the Use Supertype Where Possible refactoring dialog. Replaces occurrences of a type with one of its supertypes after identifying all places where this replacement is possible.This refactoring is available on types. |
Infer Generic Type Arguments | Starts the Infer Generic Type Arguments refactoring dialog. Replaces raw type occurrences of generic types by parameterized types after identifying all places where this replacement is possible.This refactoring is available on projects, packages and types. |
Inline | Starts the Inline refactoring dialog. Inlines local variables, methods or constants. This refactoring is available on methods, static final fields and text selections that resolve to methods, static final fields or local variables. | Alt + Shift + I
Extract Method | Starts the Extract Method refactoring dialog. Creates a new method containing the statements or expression currently selected and replaces the selection with a reference to the new method. You can use Expand Selection to from the Edit menu to get a valid selection range. This feature is useful for cleaning up lengthy, cluttered, or overly-complicated methods. | Alt + Shift + M
Extract Local Variable | Starts the Extract Variable refactoring dialog. Creates a new variable assigned to the expression currently selected and replaces the selection with a reference to the new variable. This refactoring is available on text selections that resolve to local variables. You can use Expand Selection to from the Edit menu to get a valid selection range. | Alt + Shift + L
Extract Constant | Starts the Extract Constant refactoring dialog. Creates a static final field from the selected expression and substitutes a field reference, and optionally rewrites other places where the same expression occurs. This refactoring is available on static final fields and text selections that resolve to static final fields. |
Introduce Factory | Starts the Introduce Factory refactoring dialog. This will create a new factory method, which will call a selected constructor and return the created object. All references to the constructor will be replaced by calls to the new factory method. This refactoring is available on constructor declarations. |
Introduce Parameter | Starts the Introduce Parameter refactoring dialog. Replaces an expression with a reference to a new method parameter, and updates all callers of the method to pass the expression as the value of that parameter. This refactoring is available on text selections that resolve to expressions. |
Convert Local Variable to Field | Start the Convert Local Variable to Field refactoring dialog. Turn a local variable into a field. If the variable is initialized on creation, then the operation moves the initialization to the new field's declaration or to the class's constructors. This refactoring is available on text selections that resolve to local variables. |
Encapsulate Field | Starts the Self Encapsulate Field refactoring dialog. Replaces all references to a field with getting and setting methods. Is applicable to a selected field or a text selection resolving to a field. |

Refactoring commands are also available from the context menus in many views and the Java editor.

Refactoring support

Refactoring
Using Structured Selection

Refactoring dialogs
Extract Method Errors
Java preferences