This article is a summary of some of the most practical, complete, and time-saving eclopse shortcut keys that can help you do any of the work you do. Welcome reference.
1. Ctrl+shift+r: Open Resource
This is probably the most time-saving combination of all shortcut keys. This set of shortcuts lets you open any file in your workspace, and you only need to press the first few letters of the file name or mask name, such as Applic*.xml. The drawback is that this set of shortcuts is not available in all views.
2. Ctrl+o: Fast Outline
If you want to see the methods of the current class or a particular method, but do not want to pull the code down, and do not want to use the search function, then use Ctrl+o bar. It can list all the methods and properties in the current class, you just enter the method name you want to query, and click Enter to jump directly to where you want to go.
3. Ctrl+e: Quick Convert Editor
This set of shortcut keys will help you navigate between the open editors. Use ctrl+page down or ctrl+page up to browse the tabs before and after, but ctrl+e is more efficient when many files are open.
4. Ctrl+2,l: Assigning a value to a local variable
During development, I often write methods, such as calendar.getinstance (), and then assign the results of a method to a local variable by ctrl+2 shortcut keys. This saves me the input class name, the variable name, and the time the declaration was imported. The ctrl+f effect is similar, but the effect is to assign the result of the method to a field in the class.
5. Alt+shift+r: Renaming
Renaming properties and methods was a very troublesome thing a few years ago, and it needed a lot of searching and replacing so that the code became fragmented. Today's Java IDE provides source-processing functionality, as is eclipse. Now, the renaming of variables and methods is very simple, and you'll get used to renaming each time a better alternative name appears. To use this feature, move the mouse over the property name or method name, press Alt+shift+r, enter a new name, and then click Enter. This is done. If you rename a property in the class, you can click Alt+shift+r two times, this will call out the Source Processing dialog box, you can implement the get and set method of automatic renaming.
6. Shift+enter and Ctrl+shift+enter
Shift+enter creates a blank line below the current line, regardless of whether the cursor is at the end of the row. Ctrl+shift+enter inserts a blank line before the current line.
7. ALT + ARROW key
This is also a magic weapon to save time. This combination moves the contents of the current line up or down. In the Try/catch section, this shortcut is especially useful.
8. Ctrl+m
Large display screen can improve productivity is known to everyone. Ctrl+m is the shortcut key for maximizing the editor window.
9. Ctrl +. And Ctrl+1: Next error and quick change
CTRL +. Moves the cursor to the next report fault or warning in the current file. This set of shortcut keys I generally use with ctrl+1, that is, modify the proposed shortcut keys. The new version of Eclipse suggestions are good to help you solve a lot of problems, such as missing parameters in the method, Throw/catch exception, non-executed methods and so on.
More shortcut key combinations can be viewed at Eclipse Press Ctrl+shift+l.
Let's use the frequency to see some of my favorite hotkey combinations. (Note: The following are tested on Eclipse3.02 and one version)
1. Control-shift-t: Opens type (open type). If you don't intentionally skiving, forget to open it through the source tree. Using Eclipse to easily open an implementation class for an interface, press CTRL+T to list the implementation class of the interface
2. Control-shift-r: Open resources (not just for Java files). tip: Use the yellow two-headed arrow button in the Navigator view to associate your editing window with the navigator. This allows you to open files that correspond to the hierarchy of the Navigator, which makes it easier to organize information. If this affects speed, turn it off.
3. F3: Opens the Declaration (open declaration). Alternatively, use Declaration Tab (in Java view mode, select Windows–> Show view-> Declaration). When you select a method in the code and press the button, it will show the entire method in the Declaration box.
4. Alt-left arrow: Back in navigation history (Navigation). just like a Web browser's Back button, it is especially useful after jumping with F3. (Used to return to the original compiled place)
5. Alt-right Arrow: Navigate the history forward.
6. Control-q: Go back to the last editing place. This shortcut is also used when you jump in the code. Especially when you're too deep, and forget what you were doing in the first place.
7. CONTROL-SHIFT-G: Search for references in Workspace (reference). This is the premise of refactoring
8. Control-shift-f: Codeàjavaàpreferencesà reformat code according to the Code style settings. Our team has a unified code format, and we put it on our wiki. To do this, we open Eclipse, select the window Style, and then set the Code formatter,code style and organize Imports. Use the export feature to generate a configuration file. We put these profiles on the wiki, and everyone in the team is imported into their eclipse.
9. Control-o: Fast Overview (Quick outline). with this shortcut, you can quickly jump to a method or property and just enter the first few letters of the name.
control-/: Comments on a line or uncomment. This is also true for multiple lines.
Control-alt-down Arrow: Copies the highlighted row or rows.
Alt-down Arrow: Moves one or more lines down. Alt-up Arrow will move up.
The other hotkeys are available in the menu. You can see a list of all the shortcut keys by pressing CONTROL-SHIFT-L (starting with version 3.1). Press Control-shift-l two times to display the Hotkey dialog (keys Preferences dialog), where you can set the hotkey yourself. I welcome your eclipse tips in the talkback section.
Most commonly used eclipse shortcut keys