Erich is Professor at Lucerne University of Applied Sciences and Arts and Distinguished Member of Technical Staff at Freescale Semiconductor. Erich has a MsCS degree and 18+ years of experience in the embedded software and tools world. He created many embedded cross C/C++ compilers and debuggers. Additionally he is researching in the domain of programming languages, real time and mechatronic systems. Erich is a DZone MVB and is not an employee of DZone and has posted 91 posts at DZone. You can read more from them at their website. View Full User Profile

10 Best Eclipse Shortcuts

04.27.2012
| 28113 views |
  • submit to reddit

Yes, eclipse is a very visual and GUI oriented IDE. But this does not mean that everything is mouse oriented. While programming I have my hands on the keyboard. So I want to do as much as possible with shortcuts and the keyboard. The good news is that eclipse comes with a great set of helpers built-in. Here is my list of my favorite hotkeys and shortcuts…

  1. F3 — Jumps to include file or variable declaration/definition. If you want to use the mouse for this, press the Ctrl key and hover over the source with the mouse. Shortcut for Navigate > Open Declaration.
  2. Alt+Left and Alt+Right — Navigate through my source to back and forward. Shortcuts for Navigate > Back and Navigate > Forward and Backward.
  3. Ctrl+Space — Content assist which proposes methods/member variables and more based on my typing. Start typing with a. and it will show me the struct members. Shortcut for Edit > Content Assist:  Content Assist

    CTRL+Space: Content Assist

  4. Ctrl+3 — Quick Access let me go to views, perspectives and more. Shortcut for Window > Navigation > Quick Access:  Quick Access

    CTRL+3: Quick Access

  5. Ctrl+M — Maximizes the current view or editor. Press Ctrl+M again and it goes back to the previous size. Shortcut for Window > Navigation > Maximize Active View or Editor.
  6. Ctrl+Shift+/ — Insert block comment, remove it again with Ctrl+Shift+\. Shortcut for Source > Add Block Comment. Depending on your keyboard layout you might re-assign this short cut (e.g. if on your keyboard ‘/’ is only reached with the Shift key).
  7. Ctrl+Shift+T — Open an element with wildcard support. Shortcut for Navigate > Open Element:  Open Element

    Ctrl+Shift+T: Open Element

  8. Ctrl+F7— Switch to next view. Pressing again Ctrl+F7 let you iterate to the next view. Use Ctrl+Shift+F7 for previous view. Shortcut for Window > Navigation > Next View:  Views

    Ctrl-F7: Views

  9. Ctrl+Alt+h — Opens the call hierarchy. Shortcut for Navigate > Open Call Hierarchy:  Call Hierarchy

    Ctrl+Alt+h: Call Hierarchy

  10. Ctrl-O — Open the Quick Outline View. Shortcut for Navigate > Quick Outline:  Quick Outline View

    Ctrl+O: Quick Outline View

If you do not like the shortcuts (or key bindings): go to Window > Preferences > General > Keys and change the bindings:

Key Bindings

Key Bindings

I admit: this is my personal list. If you know about a ‘secret’ shortcut which you would like to see on this list, post a comment.

Happy short cutting :-)

Published at DZone with permission of Erich Styger, author and DZone MVB. (source)

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Vivek Singh replied on Mon, 2012/04/30 - 12:41pm

Thanks. Ctrl 3 is so simple and so useful

Ashish Pathak replied on Mon, 2012/04/30 - 1:17pm

Ctrl+Shift+G - Search for References in the workspace

Ctrl+D - Delete Current line

Alt+Shift+R - Rename/Refactor variable/method/class

Ctrl+Shift+R - Open resource, you can type the name and open appropriate object

Alt+Shift+J - Add javadoc comments for the method 

 

 

Andrew Spencer replied on Wed, 2012/05/02 - 3:50am

It's worth knowing all the refactoring shortcuts.

For Java:

Alt+Ctrl+R rename 
Alt+Ctrl+V move 
Alt+Ctrl+I inline (a variable or a method) 
Alt+Ctrl+L local variable - makes a variable from the selected expression; the opposite of variable inlining 
Alt+Ctrl+Tbrings up the refactoring menu which you need for things like Extract Interface, Pull Up/Down etc that don't have keyboard shortcuts 

 

Rick Suggs replied on Thu, 2012/05/03 - 1:10pm

My favorite shortcuts for Java are:

Ctrl+Shift+O - Organize Imports

Ctrl+Shift+I - Inspect Element

Rod Knowlton replied on Sat, 2012/05/05 - 1:17pm

Ctrl-Shift-L to show all keyboard shortcuts available in the current context. 

 Also, it's really handy to have a key bound to Windows->Preferences->General->Keys (I use Alt-,). 

 

Alex Martínez replied on Mon, 2012/05/07 - 7:41am

Ctrl + 1

Quick fix. Create a variable, rename it, add import,... 

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.