Bug 211872 - Cannot use cursor in *file* templates
Cannot use cursor in *file* templates
Status: NEW
Product: platform
Classification: Unclassified
Component: Templates
All All
: P3 with 5 votes (vote)
Assigned To: Martin Entlicher
Depends on:
  Show dependency treegraph
Reported: 2012-04-27 18:13 UTC by BullfrogBlues
Modified: 2013-09-02 14:27 UTC (History)
1 user (show)

See Also:


Note You need to log in before you can comment on or make changes to this bug.
Description BullfrogBlues 2012-04-27 18:13:53 UTC
File templates don't allow you to set a cursor position and outputs an error in the template when you try to set a cursor position.

NOTE: cursor position works in code templates but not in file templates

To Reproduce

Open a template in the editor:
    (Tools > Templates > PHP/PHP File > Open in Editor)

Modify the template as follows:

    <#assign licenseFirst = "/**">
    <#assign licensePrefix = " * ">
    <#assign licenseLast = " */">
    <#include "../Licenses/license-${project.license}.txt">


Now create a new file based on the above template:

    New > New File...  

        (Choose File Type)  Choose the PHP File type

        Categories = PHP > Types = PHP File
    Next > Finish


(Where "|" is the cursor)

 * Copyright (c) 2012 Your Name. All rights reserved.
Expression cursor is undefined on line 7, column 3 in Templates/Scripting/EmptyPHP.php.


(Where "|" is the cursor)

 * Copyright (c) 2012 Your Name. All rights reserved.


p.s. I haven't a clue what component category to put this is.
Comment 1 Tomas Mysik 2012-05-02 03:31:56 UTC
Not PHP specific. Please evaluate, thanks.
Comment 2 Jaroslav Tulach 2012-05-18 14:40:17 UTC
Clearly an enhancement. As far as I know there are no plans to implement anything like this. We can accept a patch however.
Comment 3 nicholas.alipaz 2012-08-22 16:35:18 UTC
I would like to say that the ${cursor} variable would be useful, but moreover the true usefulness would come in allowing the file templates to be used in a similar fashion to code templates.  The two types of templates should be uniformed however have a different set of default variables if necessary.
Comment 4 Martin Entlicher 2013-09-02 14:27:42 UTC
Can be considered together with issue #206480.

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2014, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo