Apache NetBeans Wiki Index

Note: These pages are being reviewed.

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>

Apache Migration Information

The content in this page was kindly donated by Oracle Corp. to the Apache Software Foundation.

This page was exported from http://wiki.netbeans.org/DevFaqEditorHowToAddCodeTemplates , that was last modified by NetBeans user Markiewb on 2016-05-26T21:47:37Z.

NOTE: This document was automatically converted to the AsciiDoc format on 2018-02-07, and needs to be reviewed.