目录
1 SDK
2 字体
3 Eclipse快捷键
4 去掉代码区竖线
5 智能提示忽略大小写
6 Maven
7 自动导包
8 自动编译
9 快捷键生成serialVersionUID
10 快捷键生成打印日志语句
11 类注释
IDEA版本更新至2020.1.2(Ultimate Edition)。
File -> New Projects Settings -> Structure for New Projects...
File -> Settings... -> Editor -> Font
File -> Settings... -> Keymap
File -> Settings... -> Editor -> General -> Appearance -> 去掉框中的勾选内容
File -> Settings... -> Editor -> General -> Code Completion -> 去掉框中的Match case前的选项框
File -> Settings... -> Build, Execution, Deployment -> Build Tools -> Maven
File -> New Projects Settings -> Settings for New Projects... -> Build, Execution, Deployment -> Build Tools -> Maven
File -> Settings... -> Editor -> General -> Auto Import
File -> New Projects Settings -> Settings for New Projects... -> Other Settings -> Auto Import
File -> Settings... -> Build, Execution, Deployment -> Compiler
File -> New Projects Settings -> Settings for New Projects... -> Build, Execution, Deployment -> Compiler
敲击 Ctrl + Shift + Alt + / -> 点击Registry... -> 双击Shift搜索compiler.automake.allow.when.app.running,然后勾选上
File -> Settings... -> Editor -> Inspections -> 搜索框输入serialVersionUID -> 勾选框中的内容
File -> New Projects Settings -> Settings for New Projects... -> Editor -> Inspections -> 搜索框输入serialVersionUID -> 勾选框中的内容
随后就可以在实现了Serializable接口的Java Bean中自动生成serialVersionUID属性了:
File -> Settings... -> Editor -> Live Templates
点击右边的加号按钮,添加Template Group... ,名称为logs。然后选中该logs项,再点击加号按钮,添加Live Template。Abbreviation为快捷键,这里为logf;Description为相应的描述,这里为auto commons logging;Template text为日志语句,这里为:
private static final org.apache.commons.logging.Log logger = org.apache.commons.logging.LogFactory.getLog($CLASS_NAME$.class);
$CLASS_NAME$为当前类名,点击上图右下方的Edit variables按钮,填写如下的内容:
最后点击Change按钮(初次设置是Define),框中Java相关内容即可。
做完上述配置后,在需要写日志的类中输入logf快捷键即可看到结果:
File -> Settings... -> Editor -> File and Code Templates -> 右边点击Files选项卡下的Class选项
File -> New Projects Settings -> Settings for New Projects... -> Editor -> File and Code Templates -> 右边点击Files选项卡下的Class选项
/**
* ${description}
* @author Robert Hou
* @date ${YEAR}年${MONTH}月${DAY}日 ${HOUR}:${MINUTE}
**/
Interface、Enum和AnnotationType也都做同样的设置即可。