Apache NetBeans
Apache NetBeans
Latest release

Apache NetBeans 23

Download

How to add code templates?

  1. Create your template file

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE codetemplates PUBLIC "-//NetBeans//DTD Editor Code Templates settings 1.0//EN" "http://www.netbeans.org/dtds/EditorCodeTemplates-1_0.dtd">
<codetemplates>
    <codetemplate abbreviation="hello" xml:space="preserve">
        `<![CDATA[Hello ${world}]]>`
        <description><![CDATA[Bla bla bla]]></description>
    </codetemplate>
</codetemplates>
  1. Register it for the mimetype in the layer.xml

    <folder name="Editors">
        <folder name="text">
            <folder name="x-java">
                <folder name="CodeTemplates">
                    <file name="my-templates.xml" url="my-templates.xml"/>
                </folder>
            </folder>
        </folder>
    </folder>