问题:
You can create various Java code templates in Eclipse via 您可以通过Eclipse在Eclipse中创建各种Java代码模板
Window > Preferences > Java > Editor > Templates 窗口>首选项> Java>编辑器>模板
eg 例如
sysout
is expanded to: sysout
扩展为:
System.out.println(${word_selection}${});${cursor}
You can activate this by typing sysout
followed by CTRL+SPACE
您可以通过键入sysout
然后按CTRL+SPACE
来激活它
What useful Java code templates do you currently use? 您目前使用哪些有用的Java代码模板? Include the name and description of it and why it's awesome. 包括它的名称和描述以及为什么它很棒。
I am looking for an original/novel use of a template rather than a built-in existing feature. 我正在寻找原型/新颖的模板使用而不是内置的现有功能。
- Create Log4J logger 创建Log4J记录器
- Get swt color from display 从显示中获取swt颜色
- Syncexec - Eclipse Framework Syncexec - Eclipse框架
- Singleton Pattern/Enum Singleton Generation Singleton Pattern / Enum Singleton Generation
- Readfile READFILE
- Const 常量
- Traceout Traceout
- Format String 格式字符串
- Comment Code Review 评论代码评论
- String format 字符串格式
- Try Finally Lock 尝试最后锁定
- Message Format i18n and log 消息格式i18n和日志
- Equalsbuilder Equalsbuilder
- Hashcodebuilder Hashcodebuilder
- Spring Object Injection 弹簧对象注入
- Create FileOutputStream 创建FileOutputStream
解决方案:
参考一: https://stackoom.com/question/4JeU参考二: Seeking useful Eclipse Java code templates [closed]