Myeclipse中快捷键太多了,而我们熟练掌握其中常用的,便可以有很高的效率了。
下面总结:
java文件中:
ctrl+/ 注释当前行 再次按则取消注释
ctrl+shift+/ 多行注释
shitf+回车 光标移至下一行
ctrl+shift+\ 取消多行注释
设置快速生成Get/Set方法快捷键:
打开Myeclipse,=> window-->Preferences ,左上角搜索keys,之后点开 在文本搜索框输入get ,如图
选中那一行,然后点击Binding文本框,按下你自己习惯的快捷键就行了。
有时候我们写的类,方法...想写个类注释,怎么办呢?添加类注释模板就好了。
具体操作:Window -->Preferences--> Java --> Code Style --> CodeTemplates --> Comments --> types --> Edit
/**
* @ClassName: ${type_name}
* @Description: ${todo}(这里用一句话描述这个类的作用)
* @author Raven
* @date ${date} ${time}
*
* ${tags}
*/
同理加入 方法注释
Window -->Preferences--> Java --> Code Style --> CodeTemplates --> Comments -->Methods --> Edit
/**
* @Title : ${enclosing_method}
* @Description: ${todo}
* ${tags} : ${return_type}
* @author : Raven
* Create Date : ${date} ${time}
* @throws
*/
将此模板加入即可,如果想设置其他的模板,那么百度搜个模板加上就行
翻译下他们的意思:
xml文件中:
输入<!-- 之后即可自动补全当前行注释,(以前我总是用 ctrl+shitf+/ ,这个快捷键真的很不爽,用完必须要用方向键改光标位置。)真的不好。
还有 写spring 的时候,没有补全怎么办?Window -->Preferences 如图:
点击 ADD之后,弹出如下界面:
首先在 Key,填写一个你需要的约束地址。之后点击File System...,进入你spring包的目录\schema\下找到对应的约束包,选择最高版本的约束文件。选择好了如图:
ok之后,重新打开xml文件就可以自动补全了 ,这里在注意一下,有些属性 需要补全的话, 按下 alt+/ 即可。
最后送上 spring 最全约束:
<beans xmlns="http://www.springframework.org/schema/beans"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns:context="http://www.springframework.org/schema/context"
xmlns:aop="http://www.springframework.org/schema/aop"
xmlns:tx="http://www.springframework.org/schema/tx"
xsi:schemaLocation="http://www.springframework.org/schema/beans
http://www.springframework.org/schema/beans/spring-beans.xsd
http://www.springframework.org/schema/context
http://www.springframework.org/schema/context/spring-context.xsd
http://www.springframework.org/schema/aop
http://www.springframework.org/schema/aop/spring-aop.xsd
http://www.springframework.org/schema/tx
http://www.springframework.org/schema/tx/spring-tx.xsd">
<beans>