Home Tutorials Training Consulting Books Company Contact us


Get more...

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.

Ctrl+3 shortcut dialog
Table 1. Navigation
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

Table 2. Navigation between editors
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

Table 3. Navigation between views
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

Table 4. Running 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

Table 5. Handling the editor
Shortcut Description

Shift+Alt+

Selects next enclosing semantic unit, result depending on cursor position

Shift+Alt+

Decrease selection range to next semantic unit

Table 6. Handling the 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

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.

Table 7. Cursor navigation and text selection
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

Table 8. Copy and move lines
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

Table 9. Delete
Shortcut Description

Ctrl+D

Deletes line

Ctrl+Shift+DEL

Delete until end of line

Ctrl+DEL

Delete next element

Ctrl+BACKSPACE

Delete previous element

Table 10. Create new lines
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

Table 11. Variable assignment
Shortcut Description

Ctrl+2, L

Assign statement to new local variable

Ctrl+2, F

Assign statement to new field

6. Coding

Table 12. 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

Table 13. 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.

Table 14. Must known shortcuts
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.