Control That NetBeans File Template Category!

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>
       <folder name="JUnit">
             //JUnit template content from junit\\src\\org\\netbeans\\modules\\junit\\resources\\layer.xml
       </folder>
    </folder>

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.

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed
About

Geertjan Wielenga (@geertjanw) is a Principal Product Manager in the Oracle Developer Tools group living & working in Amsterdam. He is a Java technology enthusiast, evangelist, trainer, speaker, and writer. He blogs here daily.

The focus of this blog is mostly on NetBeans (a development tool primarily for Java programmers), with an occasional reference to NetBeans, and sometimes diverging to topics relating to NetBeans. And then there are days when NetBeans is mentioned, just for a change.

Search

Archives
« April 2014
SunMonTueWedThuFriSat
  
12
13
14
23
24
25
26
27
28
29
30
   
       
Today