一. 智能提示
二. Eclipse包折叠视图
三、修改默认编码为UTF-8
四、代码块折叠 com.cb.eclipse.folding(类似Visual Studio的#region ...#endregion )
<span style="font-size:18px;"> Ctrl+Shift+Numpad_Divede(小键盘的/号)
Ctrl+Shift+Numpad_Multiply(小键盘的*号)</span>
3. 启动eclipse后,进入 window->preference 菜单选项,在配置窗口中选择 java->editor,select folding to user 中选择"Coffee Bytes Java Folding",保存后重启 eclipse 。
4. 重启之后再次进入步骤2,勾选最后一个 User Defined Regions, 保存后即可。(当然可以在User Defined Regions自定义折叠方式)
五、get/set方法自动加上字段注释
参考:http://blog.youkuaiyun.com/manageer/article/details/9028891
1. 找到Eclipse目录下搜索找到org.eclipse.jdt.ui_*.jar(*是版本号),进行备份
2. 将jar文件改成.rar格式并使用压缩软件打开。
3. 找到\org\eclipse\jdt\internal\corext\codemanipulation这个目录下的GetterSetterUtil.class这个文件。反编译修改getSetterStub 和 getGetterStub 方法,修改如下,或者直接使用(此链接文件)替换(记得要备份喔)
if (addComments) {
//field.getCompilationUnit() 得到当前类文件内容,就是要get,set的东西
//parentType.getTypeQualifiedName('.') 得到类名
//getterName 拼出get的方法名
//field.getElementName() 得到字段名
//typeName 类型
String comment= CodeGeneration.getGetterComment(
field.getCompilationUnit(),
parentType.getTypeQualifiedName('.'),
getterName,
field.getElementName(),
typeName,
accessorName,
lineDelim);
ISourceRange sr = field.getJavadocRange();
if( null != sr ) {
String filedComment = field.getSource();
filedComment = filedComment.substring(0, sr.getLength());
filedComment = filedComment.replaceAll("[\n,\r,*,/, ,\t]", "");
comment = comment.replaceFirst(field.getElementName(), filedComment);
int i = comment.lastIndexOf(field.getElementName());
int j = getCount(comment, field.getElementName());
if (i != -1 && j >= 2) {
comment = comment.substring(0, i) + filedComment + comment.substring(i + field.getElementName().length());
}
}
if (comment != null) {
buf.append(comment);
buf.append(lineDelim);
}
}
4. 开启开发工具找到Window->Preferences->Java->CodeStyle->Code Templates->Comments->Getters/Setters
getters:
- /**
- * 获取${bare_field_name}
- * @return ${bare_field_name} ${bare_field_name}
- */
- /**
- * 设置${bare_field_name}
- * @param ${bare_field_name} ${bare_field_name}
- */
注意:生成Get/Set方法时勾选上Generate method comments
六、其它设置
- 设置字体大小:Window->preferences->General——Appearance——Colors and Fonts——Basic——Text Font——Edit
- 显示行号:Window->preferences->General——Editors——Text Editors——Show line numbers
- 保存的时候,自动格式化代码:Window->preferences->java——>editor——>Save Actions
- 设置自定义代码代码风格:窗口→首选项→Java→代码样式→格式化程序→新建
- 设置注释模板:Window->preferences->java->code style ->code templates ->Comments ->typese->edit->
/**
* @author 付亮
* @date ${date}${time}
* ${tags}
*/或者在:在eclipse的安装路径下,打开eclipse.ini的配置文件
在-vmargs下加入:
-Duser.name=你的名字
6330



被折叠的 条评论
为什么被折叠?



