DevFaqEditorHowToAddCodeTemplates

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">
        <code><![CDATA[Hello ${world}]]></code>
        <description><![CDATA[Bla bla bla]]></description>
    </codetemplate>
</codetemplates>

2. 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>
Not logged in. Log in, Register

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