{"id":54,"date":"2011-10-29T16:09:55","date_gmt":"2011-10-29T14:09:55","guid":{"rendered":"http:\/\/www.pellissier.co.za\/hermien\/?p=54"},"modified":"2011-10-29T16:09:55","modified_gmt":"2011-10-29T14:09:55","slug":"manually-converting-file-types-to-use-templateregistration","status":"publish","type":"post","link":"https:\/\/www.pellissier.co.za\/hermien\/?p=54","title":{"rendered":"Manually Converting File Types to Use @TemplateRegistration"},"content":{"rendered":"<p>The NetBeans Platform allows you to define file types. Each file type has its own behaviour associated with it. The <a href=\"http:\/\/platform.netbeans.org\/tutorials\/nbm-filetype.html\">File Type Integration Tutorial<\/a> provides a lot of information about how the file types can be created and customised.<\/p>\n<p>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 <a href=\"http:\/\/platform.netbeans.org\/tutorials\/nbm-filetype.html\">tutorial<\/a> to find out how to create one) to use the new annotation, follow these steps:<\/p>\n<ol>\n<li>Remove the contents of the layer file.<\/li>\n<li>Add a package-info.java file to the module, containing the following:<\/li>\n<\/ol>\n<p>[java]@org.netbeans.api.templates.TemplateRegistration(folder=&#8221;Other&#8221;,<br \/>\n    content=&#8221;ABCTemplate.abc&#8221;, displayName=&#8221;Empty ABC file&#8221;)<br \/>\npackage org.myorg.abcfiletype;[\/java]<\/p>\n<p>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.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>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 &#8230; <a title=\"Manually Converting File Types to Use @TemplateRegistration\" class=\"read-more\" href=\"https:\/\/www.pellissier.co.za\/hermien\/?p=54\" aria-label=\"More on Manually Converting File Types to Use @TemplateRegistration\">Read more<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"spay_email":"","jetpack_publicize_message":"","jetpack_is_tweetstorm":false},"categories":[3,5],"tags":[],"jetpack_featured_media_url":"","jetpack_publicize_connections":[],"jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p1v8WL-S","_links":{"self":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/54"}],"collection":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=54"}],"version-history":[{"count":0,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=\/wp\/v2\/posts\/54\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=54"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=54"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.pellissier.co.za\/hermien\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=54"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}