Skip the navigation

Become an Eclipse hotkey showoff

By Sam Brodkin
September 2, 2005 12:00 PM ET

JavaWorld - The great thing about Eclipse is that it's so feature-rich. If you can't find a feature, then either you just haven't looked hard enough or there's a plug-in that adds it. The worst thing about Eclipse is also that it's so feature-rich. The tool bars are crowded, the menus are congested, and the configuration dialogs remind me of the Minotaur's labyrinth (although configuration is much better in Version 3.1). Even experienced Eclipse programmers are slow and clumsy users. I've looked over countless colleagues' shoulders and blurted out "Control-Shift-T" (open type) when seeing them struggling to find a class in the Eclipse navigation pane. And with a small conscious time investment, you too can stop fumbling around in Eclipse and become a hotkey showoff.

Proficiency in Eclipse is not only good for your own productivity (I know, contractors paid by the hour tend to favor text editors), but also for your curriculum vitae (CV). Since Eclipse is surfacing on many Java job descriptions these days, it has become a good buzzword to have on your CV. I put it on mine between POJO (plain-old Java object) and POJI (plain-old Java interface). More and more companies are moving to Eclipse since it's free and generally accepted by programmers, except for the few diehard IntelliJ and Emacs enthusiasts.

So that your CV isn't all lies and/or to help increase your programming productivity, in this article, I give you a few Eclipse productivity tips.

Eclipse features with hotkey combinations

Using Eclipse with hotkey combinations can be like playing a video game. Mortal Combat particularly comes to mind. To be good at Mortal Combat, you must memorize a slew of game-pad sequences. For example, to perform the Sub-Zero Skeleton Rip on your enemy, you must do a Back, Forward, Forward, Down, X-button on the game control pad. Well, Eclipse is no different. The joystick in this case is any combination of Control, Alt, Shift, letters, numbers and F-keys.

Let's go through my favorites in order of most frequently used. (Note: these are tested in Eclipse Version 3.02 and up.)

  1. Control-Shift-T: Open type. Forget manually navigating through the source tree unless you're procrastinating.

  2. Control-Shift-R: Open resource (looks for more than just Java files).

  3. A tip to go along with these first two combinations is in the Navigator view, accessed from the yellow double-arrowed Link With Editor icon. This will make the file you open appear in the navigator hierarchy, which is often good orientation information. Turn it off if things get too slow.
  4. F3: Open declaration. Alternatively, you can click on the Declaration tab (in the Java perspective, go to Window, then Show View, then Declaration). This key shows entire method declarations in the declaration pane when you click on a method call in the code.

  5. Alt-left arrow: Go back in navigation history. Works like a Web browser's back button and comes in handy after jumping around using F3.

  6. Alt-right arrow: Go forward.

  7. Control-Q: Go to last edit location. This key combination is also handy after you've been jumping around the code, especially if you've drilled down too deeply and have forgotten what you were doing.

  8. Control-Shift-G: Find references in workspace. Prerequisite to most refactors. For methods, this key combination is basically the opposite of F3, allowing you to navigate backwards up a method stack to find a method's callers. A feature related to this is turning on occurrence marking. Go to Window, then Preferences, then Java, then Editor, then Mark Occurrences and select a few check-box options. This highlights all occurrences in the code when you click an element designated for marking. I personally only use Mark Local Variables. Beware: Enabling too many highlights can slow Eclipse.

  9. Control-Shift-F: Reformat code (according to code style settings). Our team agreed on a coding style, and we posted the Eclipse code style-rules files to our wiki. To do that, we sat together in Eclipse and went to Window, then Preferences, then Java, then Code Style, and configured Code Formatter, Code Templates and Organize Imports. We used the Export function in each of these screens to generate the config files. We put these on the wiki, and everyone imported them into their Eclipse.

  10. Control-O: Quick outline. Within the editor, this key combination allows you to jump to a method or attribute by typing a few letters of the name.

  11. Control-/: Comment/uncomment a line. Can also work on many lines at a time.

  12. Control-Alt-down arrow: Copy highlighted line(s).

  13. Alt-down arrow: Move line(s) down. Alt-up arrow works as well

Reprinted with permission from JavaWorld.com. Copyright 2009 IDG.net, an IDG company. All rights reserved.
Additional Resources
Forrester Consulting - Optimizing Users and Applications in a Mobile World
WHITE PAPER
Solving application issues over the WAN requires careful consideration. Based on their independent research, Forrester Consulting offers recommendations on how to tackle application performance issues, insufficient bandwidth and the inability to quickly restore users in a disaster.

Read now.

Security KnowledgeVault
WHITE PAPER
Security is not an option. This KnowledgeVault Series offers professional advice how to be proactive in the fight against cybercrimes and multi-layered security threats; how to adopt a holistic approach to protecting and managing data; and how to hire a qualified security assessor. Make security your Number 1 priority.

Read now.

Cut Communications Costs Once and for All
WHITE PAPER
New IP-based communications systems are being deployed by small and midsized businesses at a rapid rate. Learn how these organizations are enabling faster responsiveness, creating better customer experiences, speeding office or mobile interactions, and dramatically reducing existing communications costs.

Read now.

App Development White Papers
The Keys to Distributed & Agile Application Development
How leading firms are winning with strategies for efficient application development, without relying on co-location.
Overcome Top 7 Admin Challenges of Active Directory
As Active Directory's role in the enterprise has drastically increased, so has the need to secure the data. Gain insight on creating repeatable,...
Insiders Can Ruin Your Company. Take Action.
Did you know that 80 percent of threats to an organization come from the inside? The threat from insiders is often overlooked in...
Top Solutions and Tools to Prevent Devastating Malware
Custom malware frequently goes undetected. According to Forrester Research, the best way to reduce risk of breach is to deploy file integrity monitoring...
Streamline Compliance and Increase ROI
Streamline, simplify, and automate compliance related activities; especially those that impact multiple business units. This white paper from NetIQ, outlines solutions that will...
All App Development White Papers
App Development Webcasts
Reduced TCO for Communications Applications with New Oracle SPARC Servers
In this webcast learn how Oracle's new SPARC T4 servers and SPARC Supercluster deliver the security, performance, and scalability required for 4G network...
Optimizing Networks for the Cloud
Join guest speaker, Rohit Mehra, IDC Director of Enterprise Communications Infrastructure, to explore current trends, discuss best practices for optimizing Data Center and...
Apps QuickStart Series Part 2: Designing and Deploying SQL Server on VMware vSphere
Download this webcast to learn about the design considerations for virtualizing SQL workloads, performance and scalability information and high-availability options, as well as...
Apps QuickStart Series Part 1: Designing and Deploying Exchange 2010 on VMware vSphere
Download this webcast to learn the virtual hardware design considerations for Exchange 2010, deployment using the building block approach, options for high-availability and...
Customer Spotlight: How IPC The Hospitalist Company Implemented Oracle on VMware
Have you been looking to hear about customer's experiences with the new VMware vCenter Site Recovery Manager product? View this webcast to learn...
All App Development Webcasts
Newsletter Sign-Up

Receive the latest news test, reviews and trends on your favorite technology topics

Choose a newsletter
  1. View all newsletters | Privacy Policy
IT Jobs