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 - add ability to set cursor position in templates
Summary: add ability to set cursor position in templates
Status: NEW
Alias: None
Product: platform
Classification: Unclassified
Component: Text (show other bugs)
Version: 7.4
Hardware: PC Mac OS X
: P3 normal (vote)
Assignee: Miloslav Metelka
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-15 17:33 UTC by athompson
Modified: 2013-04-16 12:50 UTC (History)
0 users

See Also:
Issue Type: ENHANCEMENT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
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.