tgkprog
tgkprog

Reputation: 4598

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

Upvotes: 0

Views: 336

Answers (1)

Kvk
Kvk

Reputation: 530

Using

${enclosing_type}, ${enclosing_method} 

Will solve your problem.

Upvotes: 1

Related Questions