I'm fortunate enough to spend a good part of my days writing code in an IDE and I believe that we can always be more efficient even if that means reaching the mouse less frequently.
I'm an earlier Eclipse user, and throughout the years I've learned a lot of helpful shortcuts. Most of them are very popular like the ctrl+s to save and F3 to open declaration. Here are my top 10 not so popular shortcuts available in Eclipse 3.x and by consequence IBM Rational Application Developer 6 (RAD) and newer versions.
These shortcuts not only allow me to navigate easily through the source code, but also helps me stay focus on the code I'm writing and making refactoring a second nature, which by the end of the day tends to improve the overall quality of the software.
1. Open Resource (ctrl+shift+r)
This one is probably the biggest time saver of all shortcuts. This shortcut allows you to open any file in your workspace by only typing the first letters of a file name or a mask, like applic*.xml. The only drawback of this shortcut is that it is not available in all perspectives.
2. Quick Outline (ctrl+o)
Do you want to view the methods of the current class or navigate to a specific method without having to scroll down the code or use the find function? ctrl+o is the answer. It will list all methods and attributes of the current class and you can just start typing the name you want and then press enter to navigate directly to that method or attribute.
3. Quick Switch Editor (ctrl+e)
This one will help you navigate through the open editors. You can use ctrl+page down or ctrl+page up to navigate to the next and previous tabs, but ctrl+e will be more effective when you have a lot of files opened.
4. Assign to local variable (ctrl+2, L)
During development I'm used to first write the method invocation, like Calendar.getInstance(), and then assign the return of the method to a local variable using this shortcut. It saves me the time to enter the class name, variable name and also the import declaration. The ctrl+2, F is similar but will assign the return of a method to a field in the class.
5. Rename (alt+shift+r)
Renaming attributes and methods was a big deal years ago, using a combination of search and replace that frequently would lead to broken code. Every modern Java IDE today provides refactoring capabilities and Eclipse is not different. It is so easy to rename variables and methods names that once you get used to it you'll be renaming it every time you think it is necessary or when a better name is recommended in code review sessions. To use this shortcut just move the cursor to the attribute or method name and press alt+shift+r, enter the new name and press enter. Done! All references to this method in every class in the project will be renamed automatically. If you're renaming an attribute of a class you can press alt+shift+r twice, it will display the Refactor Dialog which allows you to automatically rename the gets and set methods also when refactoring an attribute.
6. Extract Local Variable (alt+shift+l) and Extract Method (alt+shift+m)
Refactoring also includes extracting variables and methods from blocks of code. These two shortcuts allows us to do exactly that. Do you want to create a constant from that String? Just select the text and hit alt+shift+l. If that same string is in other places on the same class it will automatically be replaced there. The Extract Method is also very helpful and clever enough to know (in most cases) the arguments that must be used when you want a section of your code to be exposed as a new method. Breaking larger methods in smaller well defined methods is one of the best ways to reduce cyclomatic complexity and also to improve testability of your code.
7. shift+enter and ctrl+shift+enter
Shift+enter adds a new blank line right above moving the cursor to the new line. The difference between a regular enter is that the cursor doesn't need to be at the end of a line. The ctrl+shift+enter does the same thing adding the line right before the current line.
8. Alt+arrow keys
This one is a big time saver too. It will move the current line or selection up or down. Very helpful when moving sections of code in try/catch blocks.
We all know how productive a big screen is and the ctrl+m shortcut will maximize the editor view.
10. Next Error (ctrl+.) and Quick Fix (ctrl+1)
ctrl+. moves the cursor to the next error or warning in the current file. I use this almost always in conjunction with ctrl+1 which is the suggestion shortcut. New versions of Eclipse are pretty clever on the suggestions, helping you sort out a lot of problems like missing arguments in methods, throw/catch exception, unimplemented methods, etc.
If you want to view more shortcuts you can type ctrl+shift+L in Eclipse.
Feel free to share your favorites shortucts using the comments.