Blog Series | New Project Type

Today, I begin a blog series on my learnings of NetBeans API’s, interacting with experienced folks on the mailing lists and browsing through NetBeans sources, that might help me (possibly others as well) “Create a New Project Type” in NetBeans IDE.


I will be creating a project type that I could use in my final year project based on NetBeans Platform (updated Jun 10 ’09). Right now, I don’t know how long this series would last, but I would try to cover as much as I learn. Feel free to present your views (negative/positive), suggestions or enhancements to the approaches I will follow.


The NetBeans IDE (starting with version 4.0) organizes user work into projects. Each project corresponds to exactly one project folder on disk. A given disk folder may be a project folder or not; you cannot have two projects in one folder.

What do I think?

I think they are talking about a disk folder having a single /nbproject sub-folder, would be considered as a project by NetBeans. That means, we need to create an implementation of an interface, Project.

Project (Project API)

This (public) interface (which extends another interface Lookup.Provider) resides in Project API (Its primarily of interest to the project type provider modules, infrastructure & generic GUI).

public interface Project
extends Lookup.Provider

Now, there are two methods to be implemented, one of them specified by Lookup.Provider[1], present in Project (due to inheritance) and the other by Project[2] itself.

Refer Javadocs…


Objects implementing interface Lookup.Provider are capable of and willing to provide a lookup (usually bound to the object).


Lookup getLookup()

Get any optional abilities of this project.

As we are providing a project, so there are a number of interfaces which one should consider implementing and including in lookup, some of which are described in the related Javadocs. I will discuss only those which I have implemented.

private Lookup lookup =
                Lookups.fixed(new Object[]{
                    new MarkupInfo(),
                    new MarkupLogicalView(this),
                    new MarkupProjectOpenedHook(),
                    new MarkupProjectXmlSavedHook()

Twist in the Tale..

Hey, I had just mentioned and as per the Javadocs, we are required to add implementation of some of the recommended abilities, which I would refer to MarkupInfo (implementation of ProjectInformation) and MarkupLogicalView (implementation of LogicalViewProvider).

However, one can also add some instances of classes extending certain abstract classes. In the above case, I would refer to MarkupProjectOpenedHook (subclass of ProjectOpenedHook) and MarkupProjectXmlSavedHook (subclass of ProjectXmlSavedHook) as the abstract classes.

Status: In Progress, Not Yet Usable

Online Resources

There’s a guide which should give developers of NetBeans modules (extensions), a basic idea of how to write new project types for NetBeans 4.x, as well as use certain important parts of the project and build system functionality from other kinds of modules.


The reader is assumed to be familiar with the basics of developing NetBeans modules: how to compile Java sources against API-providing modules, make the JAR, write the manifest and XML layer, register services in global lookup, etc.

For background, the reader is encouraged to first look at the general design document which explains how the different pieces of the architecture work together to provide the user functionality.


2 thoughts on “Blog Series | New Project Type

  1. Pingback: Adding Category and Projects « N, Varun

  2. Pingback: File Templates « N, Varun

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s