Geertjan's Blog

  • June 27, 2005

Control That NetBeans File Template Category!

Geertjan Wielenga
Product Manager
In the New File wizard (Ctrl-N) there's a JUnit category containing JUnit tests. As pointed out today by John in his blog entry More Testing EJBs with NetBeans, Cactus and JUnit are closely related. Hence, if one were to create a plug-in containing Cactus tests, where better to put them than in the same category in the New File wizard as where the JUnit tests are found? But you wouldn't want that category to be called "JUnit" anymore, right? And you'd probably want the category to be right below the Java Classes category. At the end of the day you'd want the structure of the categories in the New File wizard to be something like this:

So, here are the things I needed to do in the layer.xml file:

  1. Hide the existing JUnit category:

    <folder name="JUnit_hidden" />

  2. Put the new Java Test Classes category exactly where you want it to be -- after Java Classes (the localized string for "Classes") and before Java GUI Forms (the localized string for "GUIForms"):

    <attr name="Classes/Java Test Classes" boolvalue="true" />
    <attr name="Java Test Classes/GUIForms" boolvalue="true" />

  3. Create the new Java Classes category, insert the new Cactus category and copy the old JUnit category below it:

    <folder name="Java Test Classes">
    <folder name="Cactus">
    <folder name="JUnit">
    //JUnit template content from junit\\src\\org\\netbeans\\modules\\junit\\resources\\layer.xml

That's it! And then you'll end up with a Java Test Classes category, right below the Java Classes category, containing subcategories for Cactus and JUnit.

Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.