Alt + Shift + L: Extracts local variable from an expression. Enter new method name and specify access modifier, parameters list, and then click OK to do the refactoring: 7. For example: The Extract Method dialog appears. This helps you move a selected block of code to a separate method with ease. Alt + Shift + M: Extracts a selection to a method.
You can change various elements of method signature such as access modifier, return type, parameters, exceptions, etc: 6. The Change Method Signature dialog appears. Place the cursor inside a method or select method name, and then press this shortcut. Alt + Shift + C: Changes signature of a method. This shortcut allows you to access a full list of refactoring operations which are possible for current context: 5. Alt + Shift + T: Shows refactor context menu. Choose a destination and then click OK:Ĥ. For example, select a class name and press this shortcut, the Move dialog appears. Alt + Shift + V: Moves a class, method to another destination. However, use this shortcut with care: only for names used locally in the current file: 3. Eclipse doesn’t search outside references hence this renaming is faster than the Alt + Shift +R shortcut. Ctrl + 2, R: Renames a variable, a method or a class name locally in the current file. Select whole name of the class, method or variable you want to rename, and then press this shortcut: Type new name and press Enter when done, Eclipse automatically updates all related references for the new name, including ones found in other classes. This is the most frequently used shortcut in code refactoring. Alt + Shift + R: Renames a variable, a method, a class or even a package name. Here, we round up a list of shortcut keys used for code refactoring Java code in Eclipse IDE. Thus, using shortcut keys can boost your productivity. We do refactoring most of the time when writing code.