[Eclipse] Important Shortcuts

Collection of shortcuts for Eclipse

important eclipse shortcuts for everyone

collect and written by Rossen Stoyanchev

Essential Eclipse Shortcuts

Ctrl+Shift+T Find Java Type Start typing the name and the list gets smaller. Try typing the capital letters of the class only (e.g. type „CME“ to find „ConcurrentModificationException“)
Ctrl+Shift+R Find Resource Use this to look for XML files, text files, or files of any other type. which are in your workspace.
Ctrl+E Open Editor Drop-Down Presents a popup window listing currently opened files. Start typing to limit the list or simply use the down arrow key.
Ctrl+O Quick Outline Use this to find a method or a member variable in a class. Start typing to limit the choices. Press Ctrl+O a second time to include inherited methods.
Ctrl+Space Content Assist Context sensitive content completion suggestions while editing Java code.
Ctrl+Shift+Space Context Information If typing a method call with several parameters use this to show the applicable parameter types. The current parameter where the cursor is will be shown in bold.
Ctrl+Shift+O Organize Imports After typing a class name use this shortcut to insert an import statement. This works if multiple class names haven’t been imported too.
F3 Open Declaration Drills down to the declaration of the type, method, or variable the cursor is on. This works much like a browser hyperlink.
Alt+Left Backward History This works like a browser’s Back button.
Alt+Right Forward History This works like a browser’s Forward button
Ctrl+L Go to Line Go to a specific line number.
F4 Open Type Hierarchy Show the type hierarchy (downward tree) or the supertype hierarchy (upward tree).
Ctrl+Alt+H Open Call Hierarchy Show where a method is called from. In the Call Hierarchy view keep expanding the tree to continue tracing the call chain.
Ctrl+H Open Search Dialog Opens a search dialog with extensive search options for Java packages, types, methods, and fields.
Alt+Shift+R Rename – Refactoring Use this to rename type, method, or field. All existing references will be refactored as well.
Alt+Shift+L Extract Local Variable Use this to create a local variable from the selected expression. This is useful for breaking up larger expressions to avoid long lines.
Alt+Shift+M Extract Method Use this to extract a new method from existing code. The parameter list and return type will be automatically created.

Trying Out Shortcuts

A few things to keep in mind as you try the above shortcuts. If a shortcut doesn’t have the described effect check if one of these is the cause of your problem:

  • Do you have an older version of Eclipse? Check the Help section to confirm the shortcut is available.
  • Is the shortcut applicable to the context (perspective) you’re in? For example Ctrl+Shift+T (Open Type) is applicable in the Java perspective but not in the Resource perspective. You can find out where each shortcut is applicable by pressing Ctrl+Shift+L or by checking the Help section.
  • Is the shortcut already taken by another application? If so the other application will probably come to the foreground when you use the shortcut.
  • Is the shortcut defined twice in Eclipse? This can happen on occasion if you install additional plugins with overlapping shortcuts or more likely if you’ve tried to map shortcuts of your own. If there is conflict the shortcut won’t work. To check this go to the Preferences or press Ctrl+Shift+L twice.

Additional Favorites

Here are some additional shortcuts, perhaps not essential but still very useful:

Select Enclosing Element
Restore Last Selection
Select Previous Element
Select Next Element
Useful for selecting context-sensitive blocks (e.g. surrounding loop, method, class, etc.)
Scroll Line Up
Scroll Line Down
Very handy if you want to scroll by 1 line without changing your cursor position or using the mouse.
Go to Previous Member
Go to Next Member
Great for stepping down through the methods of a Java source file.
Show Occurrences in File
Remove Occurrences Annotations
Use this to search within the same file – useful for occurrences of private fields and methods.
Ctrl+Shift+P Go to Matching Bracket Helps to find the closing bracket of lengthly if-else statements.
Incremental Find
Reverse Incremental Find
The first matching occurrence is shown with each typed letter. Press again and the next matching occurrence is shown.
Insert Line Below
Insert Line Above
Insert a line above or below the current line.
Add Block Comment
Remove Block Comment
Comment in/out blocks of code with a key stroke.
Ctrl+M Maximize Active View or Editor Maximize the current view or editor at the expense of all other currently shown views. Press again to restore to normal view.
Next Editor
Next View
Next Perspective
Learn these to switch among edited files, open views and perspectives.
Duplicate Lines
Copy Lines
Doesn’t seem like it at first but a great shortcut once you learn to use it. Instead of select, copy and paste simply select and duplicate without affecting the clipboard.
Alt+/ Word Completion This is excellent for code editing or writing plain help files with variables and other words having no English language equivalents. The word completion is based on the set of words already present in the current file.
Ctrl+I Correct Indentation Select a block of Java code or an entire class file and use this shortcut to correct its indentation.
Shift Tab
Remove Tab
Add Tab
Select one or more lines of code and use this shortcut to intent them further/less.


Collect and written by Thomas Kramar

You should try to keep your hands on keyboard. The less you touch the mouse, the more code you can write. I am trying to keep the mouse laying still and control the IDE completely using keyboard. What do you think is faster: pressing ALT + C or right clicking the project, selecting Team -> Commit?

It is said, that if a function does not have a key binding, it is useless. Below you will find a set of essential keyboard shortcuts that I love. These shortcuts are set up by default, they should all work.


Delete row. Try it! You no more need to grab the mouse and select the line, no more Home, Shift + End, Delete. Quick and clean.

ALT + Up/Down Arrow

Move the row (or the entire selection) up or down. Very useful when rearranging code. You can even select more rows and move them all. Notice, that it will be always correctly indented.

ALT + Left/Right Arrow

Move to the last location you edited. Imagine you just created a class Foo, and now you are working on a class Boo. Now, if you need to look at the Foo class, just press Alt+Left Arrow. Alt+Right Arrow brings you back to Boo.


Organize imports. What happens when you first use a class you have not yet imported? You will see an error. But when you press this magical combination, all your missing classes will be imported, and the unused imports will vanish.


Probably the most useful one. It activates the quick fix. Imagine you create a class, which implements some interface. You will get an error, because the inherited methods are not yet implemented. While you are on line where the error occurs, press this combination to activate the quick fix. Now, select the „Add unimplemented methods“ option. You can use the quick fix at every error you ever receive.

Quick fix comes handy in other situations too. My favorite is the „Split variable declaration“. Sometimes I need to broaden the scope of a variable. I activate the quick fix, split declaration, and use alt + arrow to put it where it belongs. You can find even more usages: Convert local variable to field, rename in file, Inline local variable..

You could use the „Split variable declaration“ on the bar variable, and then move it with Alt+Arrows above the try block..

Or you could use the „Add unimplemented methods“ fix here.

The best thing you can do if you see an error is to use the quick fix.


Open Type. Imagine, that you need to have a look at the Foo class. But, where is the Foo class? Is it in the Boo project and in the foo.bar package? Or somewhere else? With this shortcut, you don’t need to know. Just press it, type Foo and you are in.


Shows you a list of all open editors.


Use to move between open editors. This is an slower alternative to Ctrl + E. Comes handy in a situation when you want to periodically switch between two editors, something, what is nearly impossible with Ctrl+E as it sorts entries quite randomly. Or you might just use Alt+Arrows..


Move between views. When in editor, press Ctrl+F7 to switch to the Package Explorer, or hold Ctrl and press F7 multiple times to switch to other views.


Move between perspectives. The same as previous.

CTRL + F11

Runs the application. What gets launched depends on your settings. It will either launch the last launched class (my preffered way) or it will launch currently selected resource (the default way). If you want to change its behavior read the previous post.


Open new type wizard. This is not very quick because you have to select the wizard type (weather you want to create new class, jsp, xml or something else) in the next step. Much faster way would be if you could just hit the shortcut and invoke the particular wizard. It is possible, just keep reading..


Maximize or umaximize current tab.


Corrects indentation.


Formats code. You can make a beautiful looking code out of a mess with this. It requires a bit of setup, but it is well worth it. You can find its settings under Window->Preferences->Java->Code style->Formatter


Incremental search. Similar to the search in firefox. It shows you results as you type. Don’t be surprised, if you hit this combination, nothing happens – at the first glance. Just start typing and eclipse will move your cursor to the first ocurence.


Shows you a list of your currently defined shortcut keys.

I don’t like your shortcuts

Such is life nowadays. Remember, you can always change those bindings to match your preferences. Open Windows->Preferences->General->Keys. Now you can use the filter to find your shortcut and change its binding.
The real fun begins when you cannot find the command you are looking for. The key here, is to have the „Include unbounds commands“ checkbox checked. It will show you all commands, even those, which have no keys bound.

While you are here, I recommend to add the following bindings:


Bind this to „Generate getters and setters“. This is a „must have“.


Bind this to SVN/CVS „Commit“.


Bind this to SVN/CVS „Update“.

Now, type „new“ (without quotes) in the filter text. You should see a list of all new type wizards. Choose the most frequently used and assign them a shortcut. For example, the most used wizard for me is the new class wizard. Thus I assigned it the CTRL+SHIFT+N keys.

Let me demonstrate a quick way to create new class now.

Hit CTRL + SHIFT + N (or the combination you assigned in the previous step). This should bring up new class wizard. Type in the name and press ALT+E. You can now select a class which will be a superclass for the newly created class. Hit ALT+A and select all implemented interfaces . Now hit ALT+F and your class will be generated. Eclipse will also provide the default implementation for all abstract and interface methods you inherited.

Did you notice the weird underscores everywhere in the dialog? They give you a hint about the shortcut key. Hit ALT and the underlined letter to press the button, check the checkbox or get focus for a textfield.

Did you notice the underscores?

I think that using shortcut keys is the fastest way to productivity and if not, then at least your wrists will say you a silent thanks. Now, don’t wait, go on and assign keys to the features you use most.

One final tip from Andriy:

The problem is that there are so many keyboard shortcuts. I used to keep a printout with all the shortcuts I wanted to use. Finally I wrote an Eclipse plugin MouseFeed, which reminds the keyboard shortcuts for the actions called with mouse. You can even tell it to enforce some shortcuts – the action will run only if called with a keyboard shortcut.

So if you are struggling with yourself, if you want to use shortcuts, but always subconsciously touch the mouse, install the plugin and let it enforce the shortcuts – the mouse will be useless and you will be forced to use keyboard.


Kommentar verfassen

Trage deine Daten unten ein oder klicke ein Icon um dich einzuloggen:


Du kommentierst mit Deinem WordPress.com-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Twitter-Konto. Abmelden / Ändern )


Du kommentierst mit Deinem Facebook-Konto. Abmelden / Ändern )

Google+ Foto

Du kommentierst mit Deinem Google+-Konto. Abmelden / Ändern )

Verbinde mit %s