Eclipse related settings

1. Download and installation of eclipse

Eclipse download and installation: https://blog.csdn.net/qq_39135287/article/details/82108080

Two, Eclipse settings

2.1 Modify the code set

① Modify Eclipse's default workspace encoding set, the default encoding set is GBK, changed to UTF-8.

a. Find Window → Preferences, enter Workspace in the upper left corner of the input box, find the second Workspace, modify the encoding set to UTF-8, and finally click the Apply and Close button.

② Modify the Eclipse resource file encoding set to UTF-8.

a. Find Window → Preferences, enter Content Types in the upper left corner of the input box, find General → Content Types, and click to open the Text in Content Types:.

b. Find Java Properties File, Java Source File and XML under Text, enter UTF-8 in the Default encoding input box below, and click the Apply and Close button.

2.2 Set ctrl + s to automatically format all lines when saving

Find Window → Preferences, enter Save Actions in the upper left corner of the input box, find Java → Editor → Save Actions, check the first three options, and finally click the Apply and Close button.

2.3 Set content automatic prompt

1. By default, Eclipse will automatically prompt the content when you press the point (ie.). Now it is set to automatically prompt the content of any letter except for pressing the point.

2. Find Window → Preferences, enter Content Assist in the upper left corner of the input box, find Java → Editor → Content Assist, and enter .qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM in the input box corresponding to Auto activation triggers for java, and finally click the Apply and Close button.

2.4 Modify the default encoding set of jsp

The default encoding set is ISO Latin-1, modified to ISO 10646/Unicode (UTF-8)

Find Window → Preferences, enter JSP Files in the upper left corner of the input box, find Web → JSP Files, select ISO 10646/Unicode (UTF-8) in the Encoding drop-down selection box, and finally click the Apply and Close button.

2.5, modify the Eclipse default browser

1. The web program runs by default using Eclipse's built-in browser, modified to use an external browser, such as Firefox, Google

2. Find Window → Preferences, enter Web Browser in the upper left corner of the input box, find General → Web Browser, the default selection is Use internal web browser, we modify the selection Use external web browser, and check your favorite in External web browsers Browser, I checked Chrome here, and finally clicked the Apply and Close button.

2. Some people will ask, why is there no Firefox option here? So how should I add Firefox options? There is a New button on the right side of the Web Browser window. Click it to add an external browser and there will be an option for Firefox browser, and then check Firefox browser.

2.6, Eclipse code template construction

When you are tired of writing a certain piece of code, you can build a code template and create your template content by template name. For example: when you enter try_catch_finally and press Enter, the following code snippet will appear

try {
    
    
	
} catch (Exception e) {
    
    
	throw new RuntimeException(e);
} finally{
    
    
 
}

Find Window → Preferences, enter Templates in the upper left corner of the input box, find Java → Editor → Templates, click the New button, customize the code template, and finally click the Apply and Close button.

2.7 Eclipse shortcut key configuration

一、找到 Window → Preferences,在左上角的输入框中输入Keys,找到General → Keys,在Keys视窗的输入框中

		输入Debug Java Application,找到它修改它的Binding为Alt+E
		
		输入Debug JUnit Test,找到它修改它的Binding为Alt+R
		
		输入Debug on Server,找到它修改它的Binding为Alt+Q


 二、 修改完之后,在输入框中输入你修改的快捷键,例如:在输入框中输入Alt+E,看是否会有快捷键冲突,如果有冲突,点击冲突的那一行选项,再点击Unbind Command即可解除快捷键绑定即可。 

2.8 Eclipse configuration annotation template method annotation template

①Class annotation template configuration

1. Find Window → Preferences, enter Code Templates in the upper left corner of the input box, find Java → Code Style → Code Templates, select Comments in the Code Templates window, configure the comment template (ie alt+shift+j to add comments manually

2. Select Comments → Types configuration class comment template (that is, manually add comments), double-click Types, and add the following code to your Pattern

Tips:
1. Place the cursor on the class name and press the shortcut key alt+shift+j to add the comment of the class.
2. Place the cursor on the method name and press the shortcut key alt+shift+j to add a comment of the method)

/**
 *
 * @版权 : Copyright (c) 2017-2018 *********公司技术开发部
 * @author: 作者姓名(一般是写姓名的拼音)
 * @E-mail: 邮箱
 * @版本: 1.0
 * @创建日期: ${date} ${time}
 * @ClassName ${type_name}
 * @类描述-Description:  ${todo}(这里用一句话描述这个方法的作用)
 * @修改记录:
 * @版本: 1.0
 */

②Method annotation template configuration

1. Find Window → Preferences, enter Code Templates in the upper left corner of the input box, find Java → Code Style → Code Templates, select Code in the Code Templates window, configure the code template (that is, automatically generate comments when creating a class)

2. Select Comments → Methods to configure the comment template of the method (that is, add comments manually), double-click Methods, and add the following code to your Pattern

/**
 * @Title: ${enclosing_method}
 * @Description: ${todo}(这里用一句话描述这个方法的作用)
 * ${tags}    参数描述
 * @return ${return_type}  返回类型
 * @throws
 */

3.0, Eclipse background color configuration

1. Find Window → Preferences, enter Text Editors in the upper left corner of the input box, find General → Editors → Text Editors, select Background color in the Appearance color options in the Text Editors window, and uncheck the System Default on the right. Click the color selection box next to Color

2. In the pop-up color selection box, click the specified custom color (D) button, set hue (E): 85, saturation (S): 123, brightness (L): 205, and the corresponding red ® green ( G) Blue (U) will change accordingly, just click OK

3.1, Eclipse font size setting

1. Find Window → Preferences, enter Colors and Fonts in the upper left corner of the input box, find General → Appearance → Colors and Fonts, select Text Font in Basic in the Colors and Fonts window, click Edit on the right, and select the corresponding font Size

3.2, Eclipse removes the package name automatically added before the class name or interface name

1. When we input List and click Enter, java.util.List is output, Eclipse also brings the previous package name java.util, and we hope that the previous package name is imported through import, which is We need to remove the package name that was automatically added before.

2. Find Window → Preferences, enter Content Assist in the upper left corner of the input box, find Java → Editor → Content Assist, and check the Add import instead of qualified name option in the Content Assist window

3.3, Eclipse settings do not format comments

1. Find Window → Preferences, enter Formatter in the upper left corner of the input box, find Java → Code Style → Formatter

2. Then click the New button to create a new Active profile of your own (name custom), remember not to use the Active profile that comes with eclipse

3. After that, an editing interface will pop up, select Comments, uncheck "Enable Javadoc comment formatting", and finally click the OK button

4. Check whether the Active profile is an Active profile created by yourself, and finally click Apply and Close

Reprint link: https://blog.csdn.net/qq_39135287/article/details/82080373

Guess you like

Origin blog.csdn.net/ChangeNone/article/details/112260949