Eclipse Shortcuts

Eclipse Shortcuts

This article lists helpful Eclipse shortcuts. It is based on Eclipse 4.2 (Juno).


Table of Contents

1. Shortcuts
2. Master Shortcut
3. Navigation
4. Run
5. Editing
6. Coding
7. Refactoring
8. Minimum
This tutorial is part of this Kindle book:
Kindle Edition

1. Shortcuts

Using shortcuts make a developer more productive. The following lists the most important shortcuts for Eclipse.

2. Master Shortcut

Eclipse provides keyboard shortcuts for the most common actions. Using shortcuts is usually preferable as you can perform actions much faster.

The master shortcut is Ctrl+3. This shortcut puts the focus into the Quick Access search box. In the quick access search box, you can type the name of any command, preference, wizard, view, perspective, etc. You can type only parts of the name and the dialog shows you possible matching elements.

Ctrl+3 shortcut dialog

3. Navigation

Table 1. Navigation

Shortcut Description
Ctrl + Shift + R Open / Search for resources, e.g. files
Ctrl + Shift + T Open / Search for Types
Ctrl + E Allows to select an editor from the currently open editors
Ctrl + F8 Shortcut for switching perspectives
Alt + ← or Alt + → Go to previous/ next editor position in history
Ctrl-PageUp/PageDown Switch to previous/next editor
F3 Go to the declaration of this variable
Ctrl + Shift + P Go to the matching bracket

Table 2. Search

Shortcut Description
Ctrl + . Go to the next problem / error
Ctrl + , Go to the previous problem / error
F4 on a variable Show type hierarchy
Ctrl + J , Ctrl + K Incremental search, find next
Ctrl + Shift + G Search for references in the workspace

4. Run

Table 3. Running programs

Shortcut Description
Ctrl + F11 Run last launched
Alt + Shift + X – J Run current selected class as Java application

5. Editing

Table 4. 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
Ctrl + O Show all methods of the current class, press Ctrl + O again to show the inherited methods.
F12 Focuses on the editor (especially helpful if you work with Fast Views).
Ctrl + M Maximize Java editor
Ctrl + Shift + F Format source code
Ctrl + Shift + O Organize the imports; will import the missing import statements.
Ctrl + Q Go to position the cursor at the last changed position in the editor.
Ctrl + Alt + Z Wrap the select block of code into a block, e.g. try/catch.

Table 5. Arrow Keys

Shortcut Description
Ctrl + Left Move one element to the left
Ctrl + Right Move one element to the right
Ctrl + Alt + Up/Down Copy line
Alt + Up / Down Move line up / down
Alt + Shift Up / Down Select the previous / next syntactical element
Alt + Shift Up / Down / Left / Right Extending / Reducing the selection of the previous / next syntactical element
Ctrl + Up / Down Scroll up / down a line in the editor

Table 6. 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 7. Variable assignment

Shortcut Description
Ctrl + 2, L Assign statement to new local variable
Ctrl + 2, F Assign statement to new field

6. Coding

Table 8. Coding

Shortcut Description
Shift + F2 Show the Javadoc for the selected type / class / method
Alt+Shift + N + Letter Type shortcut for the command, e.g. njc to create a new Java class or npip to create a new Plugin project
Alt + Shift + Z Surround block with try and catch

7. Refactoring

Table 9. Refactoring

Shortcut Description
Alt + Shift + R Rename
Ctrl+2, R Rename locally (in file), faster then Alt + Shift + R
Alt + Shift + T Opens the quick refactoring menu

8. Minimum

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

Table 10. 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
Ctrl + O Shows quick outline of a class
Advertisements

One thought on “Eclipse Shortcuts

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s