This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 255815

Summary: Code Templates: add enclosing variables
Product: platform Reporter: gualtiero65
Component: TemplatesAssignee: Martin Entlicher <mentlicher>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 8.2   
Hardware: All   
OS: All   
Issue Type: ENHANCEMENT Exception Reporter:

Description gualtiero65 2015-10-08 19:54:48 UTC
It would be very useful to have enclosing info as template variables.

By enclosing I mean the name of the package/class/method where the code template is created.

Like what is available in Eclipse: 
http://help.eclipse.org/mars/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2FgettingStarted%2Fqs-EditorTemplates.htm

See ${enclosing_type} which gives the name of the class so you can create a template like this:

private static final Logger LOGGER = LoggerFactory.get(${enclosing_type}.class);

which will be expanded with the class name.
Comment 1 Jiri Kovalsky 2015-10-09 15:49:18 UTC
Reassigned for further evaluation.
Comment 2 Martin Entlicher 2015-10-09 16:26:48 UTC
Looks like a reasonable enhancement.