简体   繁体   中英

eclipse -> Code Templates what are the variables available?

Found from Change unhandled exception auto-generated catch code in Eclipse? that we can use ${exception_var} and looking at http://help.eclipse.org/luna/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Freference%2Fpreferences%2Fjava%2Fcodestyle%2Fref-preferences-code-templates.htm but which of these can I use in a try catch block to get a unique (to that class) name?

Reason : my developers (8) of them find it VERY difficult to edit these, and a lot of times code goes to production, where we have shut off log4j method name printing, so we see exception but not sure which line in a class its from.

Tried using

${index:newName(int)}

But says

Variable 'newName' is unknown

Update : KVK comment helped, plus need to restart to see changes for try-catch at least

Using

${enclosing_type}, ${enclosing_method} 

Will solve your problem.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM