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 macOS

This description uses the shortcuts based on Windows and Linux. macOS uses the Cmd key frequently instead of the Ctrl key.

2. Quick Access

Ctrl+3 opens Quick Access. It finds and runs any command, for example to open a view, a wizard, a preference page or an open editor. Type a part of the name and select the entry.

The following screenshot shows the entries for "New".

Quick Access
Table 1. Navigation
Shortcut Description

Ctrl+Shift+R

Open a resource, for example a text file

Ctrl+Shift+T

Open a Java type

Ctrl+F8

Switch to the next perspective

Table 2. Navigation between editors
Shortcut Description

Ctrl+E

Select one of the open editors

Alt+←

Go back to the previous location, also in another editor

Alt+→

Go forward to the next location

Ctrl+Q

Go to the last edit location

Ctrl+PageUp

Switch to the previous editor

Ctrl+PageDown

Switch to the next editor

Table 3. Navigation between views
Shortcut Description

Ctrl+F7

Switch to another view, repeat the key to cycle through the views

Alt+Shift+Q

Show the menu of the Show View key bindings

Alt+Shift+Q, P

Show the Package Explorer

Alt+Shift+Q, C

Show the Console

4. Running Java programs

Table 4. Running programs
Shortcut Description

Ctrl+F11

Run the last launched application

F11

Debug the last launched application

Ctrl+Alt+B

Skip all breakpoints, for example to use the debug mode only for hot code replace

Alt+Shift+X, J

Run the selected class as Java application

Alt+Shift+X, T

Run as JUnit test

Alt+Shift+X, P

Run as JUnit Plug-in Test

5. Editing in the Java editor

Table 5. Editor
Shortcut Description

Ctrl+1

Quick Fix for the cursor position

Ctrl+Space

Content assist

Ctrl+T

Show the type hierarchy of the class or method

Ctrl+O

Show the methods of the class, press again to include inherited methods

Ctrl+M

Maximize or restore the active editor or view

Ctrl+Shift+F

Format the source code

Ctrl+I

Correct the indentation

Ctrl+F

Open the find/replace bar

Ctrl+Shift+O

Organize imports, adds missing and removes unused imports

Alt+Shift+Z

Surround the selection, for example with try/catch

Table 6. Cursor navigation and selection
Shortcut Description

Ctrl+← or Ctrl+→

Move to the previous or next word

Ctrl+↑ or Ctrl+↓

Scroll one line up or down

Ctrl+Shift+P

Go to the matching bracket

Shift+cursor keys

Select text

Alt+Shift+↑

Expand the selection to the enclosing element

Alt+Shift+↓

Restore the previous selection

Alt+Shift+← or Alt+Shift+→

Expand the selection to the previous or next element

Table 7. Copying and moving lines
Shortcut Description

Ctrl+Alt+↓

Duplicate the current line below

Ctrl+Alt+↑

Duplicate the current line above

Alt+↑

Move the line up

Alt+↓

Move the line down

Table 8. Deleting
Shortcut Description

Ctrl+D

Delete the line

Ctrl+Shift+Delete

Delete to the end of the line

Ctrl+Delete

Delete the next word

Ctrl+Backspace

Delete the previous word

Table 9. Creating new lines
Shortcut Description

Shift+Enter

Insert a line below the current line and move the cursor there, without splitting the current line

Ctrl+Shift+Enter

Insert a line above the current line

Table 10. Assigning to variables
Shortcut Description

Ctrl+2, L

Assign the expression to a new local variable

Ctrl+2, F

Assign the expression to a new field

6. Coding

Table 11. Coding
Shortcut Description

F2

Show the Javadoc of the element under the cursor in a hover

Shift+F2

Open the external Javadoc of the element

Alt+Shift+N

Open the New menu

Alt+Shift+S

Open the Source menu, for example to generate code

7. Refactoring

Table 12. Refactoring
Shortcut Description

Alt+Shift+R

Rename

Ctrl+2, R

Rename in file

Alt+Shift+M

Extract method

Alt+Shift+L

Extract local variable

Alt+Shift+T

Open the refactoring menu for the selection

8. Minimum

Every Eclipse user should know the following shortcuts.

Table 13. Must-know shortcuts
Shortcut Description

Ctrl+S

Save the active editor

Ctrl+1

Quick Fix, shows fixes and actions for the cursor position

Ctrl+Space

Content assist

Ctrl+3

Quick Access, find and run any command

Ctrl+Shift+L

Show all key bindings

Ctrl+Q

Go to the last edit location

Ctrl+D

Delete the current line

Ctrl+Shift+O

Organize imports

Ctrl+2, L or F

Assign the expression to a new local variable or field

Ctrl+Shift+T

Open a type

Ctrl+O

Quick outline of the class

Ctrl+F11

Run the last launched application

Shift+F10

Open the context menu

Ctrl+F10

Open the view menu of the active view

Home Tutorials Training Consulting Books Company Contact us


Get more...