Eclipse Usage tips and tricks

Source: Internet
Author: User

First, the use of common shortcut key Tips

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: The currently selected text is all stale in 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

Second, the code background color settings

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

,

2, the color value is configured as shown in:


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


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.

Third, add unified annotations

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


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


Click OK to complete

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

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


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:


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

5, of course, if you are really lazy, you can also directly borrow other people have already edited the comment template export XML file, and then you import the use

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




Eclipse Usage tips and tricks

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.