The most commonly used 10 shortcut keys in eclipse

Source: Internet
Author: User

an eclipse-level developer sums up what he considers to be the most useful but less well known shortcut key combination. These combinations make it easier to browse through the source code and improve the overall efficiency and quality of the development.

1. Ctrl+shift+r: Open Resources

This may be the most time-saving of all shortcut key combinations. This set of shortcuts allows you to open any file in your workspace, and you only need to press the filename or the first few letters in the 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 current class method or a specific method, but do not want to pull the code down, do not want to use the lookup function, then use Ctrl+o bar. It can list all the methods and attributes in the current class, you can just type the name of the method you want to query, and click Enter to jump directly to where you want to go.

3. Ctrl+e: Quick Transform editor

This set of shortcuts will help you navigate between open editors. Use ctrl+page down or ctrl+page up to browse the tabs before and after, but ctrl+e will be more efficient when many files are open.

4. ctrl+2,l: Assigning values to local variables

During the development process, I often write the method first, such as Calendar.getinstance (), and then assign the method's calculated result to a local variable through the Ctrl+2 shortcut key. This saves me the time to enter the class name, the variable name, and the import declaration. The effect of ctrl+f is similar, but the effect is to assign a method's calculated result to a field in the class.

5. Alt+shift+r: renaming

Renaming properties and methods a few years ago was a hassle, and it took a lot of searching and replacements to get the code to be fragmented. Today's Java IDE provides source-code processing, as does eclipse. Now that the renaming of variables and methods becomes very simple, you'll get used to renaming each time a better alternate name appears. To use this feature, move the mouse to the property name or method name, press Alt+shift+r, enter a new name, and click Return. To complete this. If you rename a property in a class, you can click Alt+shift+r two times, which will call out the Source Processing dialog box to implement the automatic renaming of Get and set methods.

6. Alt+shift+l and Alt+shift+m: Extracting local variables and methods

Source processing also includes the ability to extract variables and methods from large chunks of code. For example, to create a constant from a string, select the text and press Alt+shift+l. If the same string appears elsewhere in the same class, it is automatically replaced. Method extraction is also a very convenient function. Breaking large methods into smaller, fully defined methods can greatly reduce complexity and improve the testability of your code.

7. Shift+enter and Ctrl+shift+enter

Shift+enter creates a blank row 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.

8. ALT + Direction 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 handy.

9. Ctrl+m

It is known that large display screens can improve productivity. Ctrl+m is the shortcut key that maximizes the editor window.

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 shortcuts I use in general with ctrl+1, that is, to modify the suggested shortcut keys. The new version of Eclipse's recommendations are very good, and can help you solve a lot of problems, such as missing parameters in the method, Throw/catch exception, methods not implemented, and so on.

More shortcut key combinations can be viewed in eclipse by pressing Ctrl+shift+l.

Ctrl + SHIFT + O : Introduce and manage Imports statements Ctrl + SHIFT + T : Open Type Lookup class file Ctrl + SHIFT + F4 : Close where you hit Open Window Ctrl + O : Open declarations Ctrl + E : Opening editor (toggle window) Ctrl +/ : Note Line Alt + Shift + r: Rename ALT + SHIFT + L : Extract local variable Alt + SHIFT + M : Extract Method F3 : Open declaration

Ctrl + D: Delete Bank
Ctrl + SHIFT + F: Shaping

Ctrl + Alt +↓ (↑): Copy line down (top)
Alt +↓ (↑): Move line down (UP)
Alt +. : Output hint
Note: Personally think this shortcut key is most useful, (1) In the Java class, to output main method, just enter main and then use this shortcut key to press ENTER; to output System.out.println (), you only need to enter SYSO and then use this shortcut key to press ENTER , for example, if you want to overwrite the parent's ToString () method, you simply enter the to and use this shortcut key to press ENTER; For example, if you want to use a class with no import (such as Calendar), you can simply enter the CA and use the shortcut key to select Or, for example, to generate a Get,set method for a field, you simply enter a get and use the shortcut key to generate (default is public); (2) You can use this hint in the JSP page to enter the label (the label prompts the label attribute). (3) This shortcut key is also available in XML.

Alt+shift+j Add a doc comment to a function

# Ctrl + Shift + O: Import and manage Imports statements
After using the Formatonsave plugin has not been used, save the time automatically import.
# Ctrl + Shift + T: Open Type Lookup class file
# Ctrl + Shift + F4: Close the open window
With CTRL + W
# Ctrl + o:open declarations
# Ctrl + E: Open editor (toggle window)
# Ctrl +/: Note the bank
# Alt + Shift + R: Rename
# Alt + Shift + L: Extract local variables
# Alt + Shift + M: Extract Method
# F3:open Declaration
With Ctrl+mouse

A menu pops up after alt+shift+x,

Ctrl SHIFT + F AutoFit formatting

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.