#1 | Adding Category and Projects

If you remember, I had announced a blog series few weeks ago. Today, I would continue that with lot more to learn. By the way, during this unwanted break, I hope you have followed screencasts of Top 10 NetBeans API’s (Geertjan).


So, I had introduced, yes I just gave the introduction on how to get started understanding the relevant concepts of NetBeans Platform, so as to integrate a custom project type.

I hope you have given that a read, it takes time (if you’re new). Experienced developers might grasp them at a much better pace than I did.

Getting Started

Take a look;

What did you see? You saw new project “Category” (NbCreole) and corresponding “Projects” (Docs Project). Magic? Yes, it is.

I have still not completed creating my Project UI Specs, still I am up with this. How’s it possible?

XML Layer rocks!

Yes, the layer.xml certainly rocks. I just added few entries and I was able to get the above structure. Recall, how do you add a “New File Type”. There’s something called “Templates/Other” (by default) added into your layer.xml, just to show your file templates in “Other” category in “New File Wizard”, for almost every project.

Now, when I had surfed through NetBeans Sources, I found theย  trick to show my own “Category” and its “Project” types.

Tips & Tricks

I had started implementing a new project type, but just added the above implementation. You can peek into the following XML Layer which points to files stored here..

<!DOCTYPE filesystem PUBLIC "-//NetBeans//DTD Filesystem 1.1//EN" "http://www.netbeans.org/dtds/filesystem-1_1.dtd">
    <folder name="Templates">
        <folder name="Project">
            <folder name="NbCreole">
                <attr name="SystemFileSystem.localizingBundle" stringvalue="net.java.dev.creole.project.ui.wizards.Bundle"/>
                <file name="emptyCreole">
                    <attr name="position" intvalue="100"/>
                    <attr name="template" boolvalue="true"/>
                    <attr name="instantiatingIterator" newvalue="net.java.dev.creole.project.ui.wizards.NewCreoleProjectWizardIterator"/>
                    <attr name="SystemFileSystem.localizingBundle" stringvalue="net.java.dev.creole.project.ui.wizards.Bundle"/>
                    <attr name="SystemFileSystem.icon" urlvalue="nbresloc:/net/java/dev/creole/project/resources/doc_16_16.png"/>
                    <attr name="instantiatingWizardURL" urlvalue="nbresloc:/net/java/dev/creole/project/resources/emptyProject.html"/>

Indeed, its magic ๐Ÿ™‚

Anyways, when you click “Next”, it throws an exception because I have not yet implemented WizardDescriptor to provide further Wizards.

Not to worry, just avoid distributing the modules with the above tricks, when no implementation is done ๐Ÿ˜‰

Status: In Progress, Not Yet Usable

Next; I will blog about “Templates”, yes the one’s shown in “New File” action invoked on any node of a project’s Logical View (Projects Window). See ya, until next time.