Eclipse Usage Tips

Source: Internet
Author: User

One, commonly used shortcut keys (skilled use of shortcut keys can fully improve the efficiency of programming, vomiting blood finishing ...) )

1,alt +↑ up ARROW key: Move the selected code up, you can move a line or a piece of code directly up a few lines

2,alt +↓ down ARROW: Move the selected code down, you can move a line or a piece of code directly down a few lines

3,alt+← left ARROW key: Previous edited page

4,alt+→ RIGHT ARROW key: Next edited page
5,alt + Shift + S + Generate Getters and Setters ... : Get,set method for fast generation of variables, typically used for custom entity classes

6,alt + Shift + S + Generate Constructor using fields ... : A method for constructing a variable quickly, typically used for custom entity classes

7,alt + Shift + S + Generate constructors from superclass ... : Fast generation of parent class construction methods, typically for inheriting classes
8,ctrl + Shift + O: Automatically import all the correct packages
9,ctrl + E: pops up all open code files in the current workspace, you can quickly switch between these code files by entering the first letter search method
10,ctrl + 1: Quick fix, if there is a red line, position the cursor at the red line, you will be prompted to resolve the method
11,ctrl + t: Quickly list the hierarchy of the currently selected variable or method

12,ctrl+alt+↓ arrow key: Copy the current line to the next row (copy increase)
13,ctrl+alt+↑ up ARROW key: Copy the current line to the previous row (copy incremented)

14,alt+enter: Displays the property search for the currently selected resource (project or file)

15,shift+enter: Inserts a blank row on the next line of the current row (at which point the mouse can be at any position in the current row, not necessarily the last)
16,shift+ctrl+enter: Insert blank line in current line (principle above)

17,ctrl+shift+x: Turns the currently selected text all lowercase
18,ctrl+shift+y: Turns the currently selected text all lowercase

19,ctrl+shift+p: Locate the corresponding match (for example {}) (the cursor is in the match), the effect is similar to the mouse double-click, just double-click with the selected effect, this will only let the cursor jumps to the corresponding match position

20,alt+shift+m: Export a piece of code into a method reference so that the structure will be clearer

Second, the code background color settings

1, open Window>>preferences>general>editors>text editors>background color in eclipse

Figure 1

2, the color value is configured as shown in:

Figure 2

3, set the background color for the green bean Protection wink After the code editing interface as shown:

Figure 3

Obviously this looks more comfortable than the default pure white background, of course, in setting the background color of the interface, there are some other colors can be set, flexible use, can achieve the best eye care configuration.

4, in fact, there is a more simple way, is to set the window properties of the system color, so that there is no software changes, such as

Iii. adding unified annotations to your code

1, open eclipse in Window>>preferences>java>code style>code templates>comments>types>edit

Figure 4

Then edit the popup template, the default is only one author, you can add other useful parameters, such as the date, version, etc.

Figure 5

2, open eclipse in Window>>preferences>java>code style>code templates>comments>files>edit

This is to add comment code for the file, the note is stored at the top of the file, the first few lines, can be used as a copyright notice, such as the copyright of XXX company, of course, preferably in English, add the same method, the effect is as follows:

Figure 6

3, back to the workspace, there are two ways to generate the code templates that you just edited

A, shortcut key: Alt + Shift + J

b, when the new class is checked generate comments, such as:

Figure 7

4, add the comments after the completion of the effect as follows:

Figure 8

5, of course, if you are really lazy, you can also directly borrow someone else has edited the comment template export XML file, and then you import using, 4 shows

Iv. switching between English and Chinese in Eclipse

First of all, you have to confirm that you installed the Chinese package, in fact, the Chinese package contains most of the world's language, just call the Chinese simplified it
Then add the-NL "regional language code" to the target location of the Eclipse shortcut on the desktop and start again to complete the language switch. English: ZH_CN; English: EN

However, it is recommended to use the English version, the Chinese is not suitable for development, only for beginners.


Figure 9

Eclipse Usage Tips

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.