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 228579

Summary: add ability to set cursor position in templates
Product: platform Reporter: athompson <athompson>
Component: TextAssignee: Miloslav Metelka <mmetelka>
Status: NEW ---    
Severity: normal    
Priority: P3    
Version: 7.4   
Hardware: PC   
OS: Mac OS X   
Issue Type: ENHANCEMENT Exception Reporter:

Description athompson 2013-04-15 17:33:02 UTC
It would be nice if when creating a new file, the cursor is placed at a reasonable guess at where it's needed next. For example, in the "java main class" template:


<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">

<#if package?? && package != "">
package ${package};

</#if>
/**
 *
 * @author ${user}
 */
public class ${name} {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ${cursor}
    }

}

The cursor would be inside the method body. Another fancier possibility is to keep the default text, but select it:


<#assign licenseFirst = "/*">
<#assign licensePrefix = " * ">
<#assign licenseLast = " */">
<#include "${project.licensePath}">

<#if package?? && package != "">
package ${package};

</#if>
/**
 *
 * @author ${user}
 */
public class ${name} {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        ${select // TODO code application logic here}
    }

}

In this case the comment is still added, but it is selected.