Refactor actions



Refactor menu commands
Name
Function
Keyboard Shortcut
Undo
Does an Undo of the last refactoring. The refactoring undo buffer is only valid as long as no other source changes than refactoring have been performed.
Ctrl + Shift + Z
Redo
Does a Redo of the last undone refactoring. The refactoring undo/redo buffer is only valid as long as no other source changes than refactoring have been performed.
Ctrl + Shift + Y
Rename
Starts the Rename refactoring wizard:  Renames the selected element and (if enabled) corrects all references to the elements (also in other files). Is available on methods, fields, local variables, method parameters, types, compilation units, packages, source folders, projects and on a text selection resolving to one of these element types. 
 
Move
Starts the Move refactoring wizard: Moves the selected elements and (if enabled) corrects all references to the elements (also in other files). Can be applied on 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. 
 
Pull Up
Starts the Pull Up refactoring wizard: Moves a field or method to its super class. Can be applied on one or more methods and fields from the same type or on a text selection resolving to a field or method. 
 
Modify Parameters Starts the Modify Parameters refactoring wizard. Changes parameter names and parameter order and updates all references to the corresponding method. Can be applied on methods with parameters or on text selection resolving to a method with parameters.   
Extract Method Starts the Extract Method refactoring wizard. 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. 
 
Extract Variable Starts the Extract Variable refactoring wizard. Creates a new variable assigned to the expression currently selected and replaces the selection with a reference to the new variable. You can use Expand Selection to from the Edit menu to get a valid selection range.  
Inline Local Variable Starts the Inline Local Variable refactoring wizard. Replaces the references to the selected local variable with the variable's initializer expression and removes the variable.  
Self Encapsulate Field Starts the Self Encapsulate Field refactoring wizard. 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.

Related concepts
Refactoring support

Related tasks

Refactoring

Using Structured Selection

Related reference

Refactoring preference page
Refactoring wizard
Extract Method Errors

Copyright IBM Corporation 2000, 2002. All Rights Reserved.