Summary of the most common shortcut keys in Eclipse

Source: Internet
Author: User

1. ctrl + shift + r: Open the resource

This may be the most time-efficient combination of all shortcut keys. This set of shortcuts allows you to open any file in your workspace, and you only need to press the file name or the first few letters in the mask name, such as applic *. xml. The disadvantage is that this set of shortcut keys are not available in all views.


2. ctrl + o: Quick outline

If you want to view the method of the current class or a specific method, but do not want to pull the code down or use the search function, press ctrl + o. It lists all methods and attributes of the current class. You only need to enter the name of the method you want to query and click enter to directly jump to the desired location.


3. ctrl + e: Quick conversion Editor

This set of shortcut keys will help you browse between open editors. You can use ctrl + page down or ctrl + page up to browse the front and back tabs. However, ctrl + e is more efficient when many files are opened.


4. ctrl + 2, L: assign values to local variables

During development, I often write a method, such as Calendar. getInstance (), and then assign the calculation result of the method to a local variable by pressing ctrl + 2. In this way, the input class name, variable name, and import declaration time are saved. The effect of Ctrl + F is similar, but the effect is to assign the calculation result of the method to the domain in the class.

5. alt + shift + r: Rename

Renaming properties and methods was a hassle a few years ago and requires a lot of search and replacement, so that the Code became scattered. Today's Java IDE provides the source code processing function, as is Eclipse. Now, renaming variables and methods is very simple, and you will get used to renaming every time a better alternative name appears. To use this function, move the mouse over the attribute or method name, press alt + shift + r, enter a new name, and press Enter. This is done. If you Rename an attribute in the class, you can click alt + shift + r twice. This will call the source code processing dialog box and automatically rename the get and set methods.

6. alt + shift + l and alt + shift + m: extract local variables and Methods

Source code processing also includes the ability to extract variables and methods from large pieces 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 category, it will be automatically replaced. Method extraction is also a very convenient function. Decomposing large methods into small and fully-defined methods will greatly reduce the complexity and improve the Code testability.

7. shift + enter and ctrl + shift + enter

Shift + enter creates a blank row under the current row, regardless of whether the cursor is at the end of the row. Ctrl + shift + enter insert a blank row before the current row.

8. Alt + direction keys

This is also a magic weapon to save time. This combination moves the content of the current row up or down. In the try/catch section, this shortcut is particularly useful.

9. ctrl + m

Large display screens can improve work efficiency. Ctrl + m is the shortcut key for maximizing the size of the editor window.

10. ctrl +. And ctrl + 1: Next error and quick Modification

Ctrl +. move the cursor to the next error or warning area in the current file. I usually use this set of shortcut keys together with ctrl + 1, that is, modify the recommended shortcut keys. The new version of Eclipse is well-developed and can help you solve many problems, such as missing parameters in methods, throw/catch exception, and unexecuted methods.


Part 2:

1. Ctrl + Left click and F3

This is frequently used by most people to view the definitions of variables, methods, and classes.
Jump to the definition code of the identifier where the cursor is located. When reading by execution process, F3 implements most navigation actions.

2 Ctrl + Shift + G
Find the location of the identifier that references the cursor in the workspace. It can be said that it is the opposite of the F3 shortcut. When reading by class definition, you can quickly find out which classes are called by the current class method.

3. Ctrl + T

View the inheritance relationship tree of a class, which is top-down, and pressCtrl + T,The display structure is changed from bottom to top. Unlike the "F4" shortcut, the display mode is different.

Tip: select a method name and press Ctrl + T. You can view the parent class, subclass, and interface of the method with the same name.

Note: "T" -------> "Tree" -----> "Hierarchy Tree"

4. Alt + left and right direction keys

We often encounter situations where we read the code by pressing Ctrl + left-click, trace them layer by layer, and then get lost in the Code. In this case, we only need to press "Alt + Left-direction key" to return to the last read position, similarly, press Alt + right arrow key to move forward

The returned reading position is the same as the browser's forward and backward buttons.

Alt + --> returns the previous reading position. After you use the search or navigation function, you can use the ALT-left arrow to return to the previous reading position, which is also a multi-level historical record. Similar to IE. If you want this rewind function to achieve the best effect

Rate, You need to develop the habit of using it. For example, if you encounter a method call, use F3 to open the class file where it is located, and then apply the alt-left arrow to the back, instead of directly turning off the new tab page. Otherwise, the new tab will

Will be recorded in the history, and will be re-opened next time you move back here.

5. Ctrl + Alt + H

If you want to know whether a class method is called by other classes, select the method name and press Ctrl + Alt + H ", eclipse will display the methods called by this method, and ultimately generate a call relationship tree.

Note: "H" ---> "Hierarchy" ---> "Call level"

6.Control-Q: Return to the Last edited place.This shortcut key is also used when you jump to the code. Especially when you drill too deep and forget what you did first.

7Control-/: Comments or uncomments a line. The same applies to multiple rows.

8.Control-Alt-down arrow: copy one or more highlighted rows.

9.Alt-down arrow: move one or more rows down. Alt-up arrow moves up.

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.