NOW Hiring

Quick links

Eclipse Shortcuts. This article lists helpful Eclipse shortcuts. It is based on Eclipse 4.4 (Luna).

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.

image::short10.png[Ctrl+3 shortcut dialog]

3.1. Globally available navigation shortcuts

Eclipse provides shortcuts for opening files or Java artifacts.

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+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.

Table 2. Search from an editor
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 kbd[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, s\earch for references in the workspace

Ctrl+Shift+P

Select the matching bracket. Cursor needs to be placed before or after a bracket.

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

4. Start Java programs

Table 4. Running programs
Shortcut Description

Ctrl+F11

Run last launched

Alt+Shift+X+J

Run current selected class as Java application

5. Editing

The following lists contains useful keyboard shortcuts if you are inside your Java editor.

Table 5. Table 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 6. 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 7. 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 8. 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 9. 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 10. Variable assignment
Shortcut Description

Ctrl+2+L

Assign statement to new local variable

Ctrl+2+F

Assign statement to new field

6. Coding

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

8. Minimum

The following shortcuts are the absolute minimum a developer should be familiar with to work efficient in Eclipse.

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

kbd:[Ctrl+ D

Deletes current line in the editor

kbd:[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

9. About this website

Nothing listed.

10.1. vogella GmbH training and consulting support

TRAINING SERVICE & SUPPORT

The vogella company provides comprehensive training and education services from experts in the areas of Eclipse RCP, Android, Git, Java, Gradle and Spring. We offer both public and inhouse training. Whichever course you decide to take, you are guaranteed to experience what many before you refer to as “The best IT class I have ever attended”.

The vogella company offers expert consulting services, development support and coaching. Our customers range from Fortune 100 corporations to individual developers.

Copyright © 2012-2016 vogella GmbH. Free use of the software examples is granted under the terms of the EPL License. This tutorial is published under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Germany license.

See Licence.