【问题标题】:eclipse -> Code Templates what are the variables available?eclipse -> Code Templates 有哪些可用的变量?
【发布时间】:2014-08-10 17:14:37
【问题描述】:

Change unhandled exception auto-generated catch code in Eclipse? 发现我们可以使用 ${exception_var} 并查看 http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcodestyle%2Fref-preferences-code-templates.htm 但我可以在 try catch 块中使用其中哪些来获得唯一的(该类的)名称?

原因:我的开发人员 (8) 发现编辑这些非常困难,而且很多时候代码进入生产环境,我们关闭了 log4j 方法名称打印,所以我们看到异常但不确定在哪一行一个类。

尝试使用

${index:newName(int)}

但是说

变量“newName”未知

更新:KVK 评论有帮助,另外需要重新启动才能看到至少 try-catch 的变化

【问题讨论】:

  • 不是 ${enclosing_type} ${enclosing_method} 解决你的问题..
  • 感谢 KVK 给出答案,我会接受,Eclipse 需要重新启动以使其粘滞,应用不起作用。
  • 谢谢 tgkprog。添加它作为答案。

标签: java eclipse eclipse-plugin uniqueidentifier


【解决方案1】:

使用

${enclosing_type}, ${enclosing_method} 

会解决你的问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2017-08-26
    相关资源
    最近更新 更多