Eclipse Shortcuts. This article lists helpful Eclipse shortcuts.
1. Shortcuts
1.1. Using shortcuts in Eclipse
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.
1.2. Shortcuts on Mac OS
This description uses the shortcuts based on Windows and Linux. Mac OS uses the Cmd key frequently instead of the Ctrl key.
2. Quick Access
The Ctrl+3 shortcut allows you to perform all available actions in Eclipse. This shortcut puts the focus into the Quick Access (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 QuickAccess to search for an opened editor by typing in the name of the resource which the editor shows.
The following screenshot shows how you the available commands in quick access for the "New Java" search term.
3. Navigation and text selection
Shortcut | Description |
---|---|
Ctrl+Shift+R |
Search dialog for resources, e.g., text files |
Ctrl+Shift+T |
Search dialog for Java Types |
Ctrl+F8 |
Shortcut for switching perspectives |
Shortcut | Description |
---|---|
Ctrl+E |
Search dialog to select an editor from the currently open editors |
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+F7 |
Shortcut for switching views. Choose the view to switch to with your mouse or cycle through the entries with repeating the keystroke |
Shift+Alt+Q |
Open menu for switch view keybindings |
Shift+Alt+Q+P |
Show package explorer |
Shift+Alt+Q+C |
Show console |
4. Start Java programs
Shortcut | Description |
---|---|
Ctrl+F11 |
Run last launched |
F11 |
Run last launched in debug mode |
Ctrl+Alt+B |
Skip all breakpoints. Let’s you use debug mode for code reloading |
Alt+Shift+X, J |
Run current selected class as Java application |
Alt+Shift+X, T |
Run JUnit test |
Alt+Shift+X, P |
Run JUnit Plug-in test |
5. Editing in the Java editor
Shortcut | Description |
---|---|
Shift+Alt+↑ |
Selects next enclosing semantic unit, result depending on cursor position |
Shift+Alt+↓ |
Decrease selection range to next semantic unit |
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 |
Shift+Enter |
Adds a link break at the end of the line |
Ctrl+Shift+O |
Organize the imports; adds missing import statements and removes unused ones |
Alt+Shift+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 Ctrl+↓ |
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+↓ |
Copy current line below the line in which the cursor is placed |
Ctrl+Alt+↑ |
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 |
6. Coding
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 |
7. Refactoring
Shortcut | Description |
---|---|
Alt+Shift+R |
Rename |
Ctrl+2, R |
Rename locally (in file) |
Alt+Shift+T |
Opens the context-sensitive refactoring menu, e.g., displays |
8. Minimum
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 |
Shift+F10 |
Opens context menu. Keyboard equivalent to Mouse2 |
Ctrl+F10 |
Opens view menu for current view. |
9. Links and Literature
Nothing listed.
9.1. vogella Java example code
If you need more assistance we offer Online Training and Onsite training as well as consulting