This article lists helpful Eclipse shortcuts. It is based on Eclipse 4.2 (Juno).
Table of Contents
Using shortcuts make a developer more productive. Eclipse provides keyboard shortcuts for the most common actions. Using shortcuts is usually preferable as you can perform actions much faster.
Eclipse supports of course the typical shortcuts, e.g. Ctrl+S for saving, Ctrl+C for copying the selected text or file and Ctrl+V for pasting the element currently in the clipboard.
The Ctrl+3 shortcut allows you to perform all available actions in Eclipse. This shortcut puts the focus into the Quick Access search box which allows you to execute any Eclipse command.
For example you can open a Preference, a Wizard, a view and a Preference page.
You can also use Quick Access to search for an opened editor by typing in the name of the resource which the editor shows.
The following screenshot shows how you could use Ctrl+3 to open the Wizard to create a new Java class.
Eclipse provides shortcuts for opening files or Java artifacts.
Shortcut | Description |
---|---|
Ctrl + Shift + R | Search dialog for resources, e.g. text files |
Ctrl + Shift + T | Search dialog for Java Types |
Ctrl + E | Search dialog to select an editor from the currently open editors |
Ctrl + F8 | Shortcut for switching perspectives |
If you are working in the Java editor you can also use certain shortcuts for faster navigation. The following tables lists a few of them.
Shortcut | Description |
---|---|
F3 | Opens editor to selected element (type) or navigate to the declaration of the selected variable |
Ctrl + . | Go to the next problem / error |
Ctrl + , | Go to the previous problem / error |
F4 on a variable | Show type hierarchy |
Ctrl + J | Incremental search without popup dialog, just starting typing to search. Press Ctrl + J to find the next match |
Ctrl + K | Searches the selected text or if nothing is selected the last search from the Find dialog. |
Ctrl + Shift + G | In the Java editor, search for references in the workspace |
Ctrl + Shift + P | Select the matching bracket. Cursor needs to be placed before or after a bracket. |
Shortcut | Description |
---|---|
Alt + ← | Go to previous opened editor. Cursor is placed where it was before you opened the next editor |
Alt + → | Similar Alt + ← but opens the next editor |
Ctrl + Q | Go to editor and the position in this editor where the last edit was done |
Ctrl + PageUp | Switch to previous opened editor |
Ctrl + PageDown | Switch to next opened editor |
Shortcut | Description |
---|---|
Ctrl + F11 | Run last launched |
Alt + Shift + X, J | Run current selected class as Java application |
The following lists contains useful keyboard shortcuts if you are inside your Java editor.
Shortcut | Description |
---|---|
Ctrl + 1 | Quickfix; result depending on cursor position |
Ctrl + Space | Content assist/ code completion |
Ctrl + T | Show the inheritance tree of the current Java class or method. |
Ctrl + O | Show all methods of the current class, press Ctrl + O again to show the inherited methods. |
Ctrl + M | Maximize active editor or view |
Ctrl + Shift + F | Format source code |
Ctrl + I | Correct indentation, e.g. format tabs/whitespaces in code |
Ctrl + F | Opens the find dialog |
Ctrl + Shift + O | Organize the imports; adds missing import statements and removes unused ones |
Ctrl + Alt + Z | Wrap the select block of code into a block, e.g. try/catch. |
Shortcut | Description |
---|---|
Ctrl + ← or Ctrl + → | Move one text element in the editor to the left or right |
Ctrl + ↑ or ↓ | Scroll up / down a line in the editor |
Ctrl + Shift + P | Go to the matching bracket |
Shift + Cursor movement | Select text from the starting position of the cursor |
Alt + Shift ↑ / ↓ | Select the previous / next syntactical element |
Alt + Shift ↑ / ↓ / ← / → | Extending / reducing the selection of the previous / next syntactical element |
Shortcut | Description |
---|---|
Ctrl + Alt + Cusor Down | Copy current line below the line in which the cursor is placed |
Ctrl + Alt + Cusor Up | Copy current line above the line in which the cursor is placed |
Alt + Up | Move line one line up |
Alt + Down | Move line one line down |
Shortcut | Description |
---|---|
Ctrl + D | Deletes line |
Ctrl + Shift + DEL | Delete until end of line |
Ctrl + DEL | Delete next element |
Ctrl + BACKSPACE | Delete previous element |
Shortcut | Description |
---|---|
Shift + Enter | Adds a blank line below the current line and moves the cursor to the new line. The difference between a regular enter is that the currently line is unchanged, independently of the position of the cursor. |
Ctrl+Shift+Enter | Same as Shift + Enter but above |
Shortcut | Description |
---|---|
Ctrl + 2, L | Assign statement to new local variable |
Ctrl + 2, F | Assign statement to new field |
Shortcut | Description |
---|---|
Shift + F2 | Show the Javadoc for the selected type / class / method |
Alt+Shift + N | Shortcut for the menu to create new objects |
Alt + Shift + Z | Surround block with try and catch |
Shortcut | Description |
---|---|
Alt + Shift + R | Rename |
Ctrl + 2, R | Rename locally (in file), faster than Alt + Shift + R |
Alt + Shift + T | Opens the context-sensitive refactoring menu, e.g. displays |
The following shortcuts are the absolute minimum a developer should be familiar with to work efficient in Eclipse.
Shortcut | Description |
---|---|
Ctrl + S | Saves current editor |
Ctrl + 1 | Quickfix; shows potential fixes for warnings, errors or shows possible actions |
Ctrl + Space | Content assist/ code completion |
Ctrl + Q | Goes to the last edited position |
Ctrl+ D | Deletes current line in the editor |
Ctrl + Shift + O | Adjusts the imports statements in the current Java source file |
Ctrl + 2, L or F | Assign statement to new local variable or field |
Ctrl + Shift + T | Open Type Dialog |
Ctrl + O | Shows quick outline of a class |
Ctrl + F11 | Run last launched application |
JUnit Tutorial Test your application
Git Tutorial Put all your files in a distributed version control system