Oct 292011

The NetBeans Platform allows you to define file types. Each file type has its own behaviour associated with it. The File Type Integration Tutorial provides a lot of information about how the file types can be created and customised.

With NetBeans Platform 7.1, it is now possible to register a file type with the @TemplateRegistration annotation instead of using the layer file. To manually convert an existing file type (read the tutorial to find out how to create one) to use the new annotation, follow these steps:

  1. Remove the contents of the layer file.
  2. Add a package-info.java file to the module, containing the following:

    content="ABCTemplate.abc", displayName="Empty ABC file")
package org.myorg.abcfiletype;

Clean and build the module, and inspect the generated layer file to see the result. The generated layer file will be located at build/cluster/modules/AbcFileType.jar/META-INF/generated-layer.xml.