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 CtrlH to search in all files across the workspace or project.

Search Dialog in Eclipse Juno

Open Resource

CtrlShiftR 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 CtrlShiftT to open a Java type.

Open Type Dialog in Eclipse Juno

While I prefer CtrlShiftR to search for files, CtrlShiftT works better if you want to search for Java classes or interfaces.

Open the Type Hierarchy

Use CtrlT 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 CtrlT again to toggle between super-types and sub-types.

Display members and inherited members

Pressing CtrlO 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 CtrlI 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 CtrlN to start the new File Wizard.

New File Wizard - Eclipse Juno

Lesser Known Shortcuts

CtrlTab 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 CtrlPgUp and CtrlPgDn to switch between tabs in your current viewwithout showing you the complete list of available tabs.

Scroll without using the mouse

Use CtrlUp and CtrlDown to scroll, while keeping your cursor in the same position!

Move a line or lines

Use AltUp and AltDown to move selected lines, or the current line.

Jump to matching bracket

CtrlShiftP on a bracket, brace or parenthesis moves the cursor to its matching bracket, brace or parenthesis.

Progressively Select Blocks

Use ShiftAltUp / ShiftAltDown to progressive select blocks.

Find references

CtrlShiftG will find references to the item under the cursor.

Find declarations (Only C++/Javascript)

CtrlG 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 ShiftCtrlK and CtrlK to find the previous and next occurrences of the item under the cursor.

I had to set CtrlK 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 CtrlSpace 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 Ctrl3 and then the initial letters of the item you want.

Eclipse Juno quick access menu

History

Use AltLeft and AltRight 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 Ctrl1 to get to the quick fix menu and quickly fix compile-time issues.

Eclipse Ctrl-1 quick fix menu

Debugging

Use CtrlR to run to the current line. Use CtrlShiftB to toggle a breakpoint. F11 debugs the last run program, while CtrlF11 runs it.

Refactoring

ShiftAltR renames an item and updates all references. Use ShiftAltL to extract code to a local variable, and ShiftAltM to move code to a method.

The Best of them all!

And finally, which one’s the greatest shortcut of all? Use CtrlShiftL 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 *