List of Shortcuts for the Eclipse Java IDE

Here’s a cheat sheet of Eclipse shortcuts I’ve put together to help me work really fast with the IDE. The shortcuts have been categorized into two sections – one that most people know about, and another section that contains the lesser known ones. You should be able quickly scan through the first section, and learn any of the ones that you don’t currently know.

The second section might take longer, and you may want to bookmark this page for future reference.

Easy Shortcuts

Search in files

Use Ctrl-H to search in all files across the workspace or project.

Search Dialog in Eclipse Juno

Open Resource

Ctrl-Shift-R opens a resource quickly – without the time it spends for indexing. This makes it especially fast when you’ve just opened a workspace, in comparison to the Open Type shortcut below.

Open Resource Dialog in Eclipse Juno

Open Type

Use Ctrl-Shift-T to open a Java type.

Open Type Dialog in Eclipse Juno

While I prefer Ctrl-Shift-R to search for files, Ctrl-Shift-T works better if you want to search for Java classes or interfaces.

Open the Type Hierarchy

Use Ctrl-T to get a popup window with the type hierarchy for the type under your cursor.

Type hierarchy popup - Eclipse Juno

This is tremendously useful to see inherited types, sub-types, and implemented interfaces.

Press Ctrl-T again to toggle between super-types and sub-types.

Display members and inherited members

Pressing Ctrl-O displays the class members, pressing it again displays the inherited members too!

Eclipse class members popup

Focusing on the tooltip

Press F2 to get the tooltip for the item currently under the cursor.

F2 Tooltip Eclipse Juno

Correcting Indentation of Selected Text

Use Ctrl-I to correct indentation.

Debuggging

Use F5 to Step into, F6 to Step over, F7 to step out, and F8 to resume. See below for more shortcuts on debugging.

New File Wizard

Use Ctrl-N to start the new File Wizard.

New File Wizard - Eclipse Juno

Lesser Known Shortcuts

Ctrl-Tab to Switch Between Windows

Go to General->Keys to see all shortcuts.

Setting Eclipse Juno shortcut for switching between editor windows

Change the binding of Next Editor and Previous Editor to use Tab instead of F6 – this makes it incredibly easy to switch between open editors. I often dislike changing keyboard shortcuts so that it’s easy to work on someone else’s machine too, but I couldn’t resist this one.

Cycle through tabs in the current view

Similar to the above, but still slightly different: Use Ctrl-PgUp and Ctrl-PgDn to switch between tabs in your current viewwithout showing you the complete list of available tabs.

Scroll without using the mouse

Use Ctrl-Up and Ctrl-Down to scroll, while keeping your cursor in the same position!

Move a line or lines

Use Alt-Up and Alt-Down to move selected lines, or the current line.

Jump to matching bracket

Ctrl-Shift-P on a bracket, brace or parenthesis moves the cursor to its matching bracket, brace or parenthesis.

Progressively Select Blocks

Use Shift-Alt-Up / Shift-Alt-Down to progressive select blocks.

Find references

Ctrl-Shift-G will find references to the item under the cursor.

Find declarations (Only C++/Javascript)

Ctrl-G finds declarations of the item under the cursor.

Open Declaration

F3 opens the declaration for the item under the cursor.

Find previous and next, based on selection

Use Shift-Ctrl-K and Ctrl-K to find the previous and next occurrences of the item under the cursor.

I had to set Ctrl-K for “Find next” in Preferences->General->Keys, but the shortcut for “Find previous” was there by default.

CamelCase Code Completion

If you have a class that has a VeryLongName, simply type VLN and press Ctrl-Space to see VeryLongName as one of the suggestions.

Automatically Insert Braces and Semicolons at the correct position

This isn’t a shortcut – but a useful productivity boost. Setting semicolons and braces to be automatically inserted in the correct position allows you to type them in from anywhere but they actually appear at the end of the line. Escaping text in string literals is another useful option.

Eclipse Juno preferences - automatic insertion of braces and semicolons at correct position and escaping pasted strings

Quick Access Menu

Quickly access any menu, command, editor, etc by typing in Ctrl-3 and then the initial letters of the item you want.

Eclipse Juno quick access menu

History

Use Alt-Left and Alt-Right to navigate between your editor history items. This is equivalent to using the history icons on the toolbar.

Eclipse Juno history toolbar buttons

Quick Fix

Use Ctrl-1 to get to the quick fix menu and quickly fix compile-time issues.

Eclipse Ctrl-1 quick fix menu

Debugging

Use Ctrl-R to run to the current line. Use Ctrl-Shift-B to toggle a breakpoint. F11 debugs the last run program, while Ctrl-F11 runs it.

Refactoring

Shift-Alt-R renames an item and updates all references. Use Shift-Alt-L to extract code to a local variable, and Shift-Alt-M to move code to a method.

The Best of them all!

And finally, which one’s the greatest shortcut of all? Use Ctrl-Shift-L to get a list of all available shortcuts!!

Eclipse Juno list of shortcuts

\

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>