# Building MyRCP..

Recently, I posted a question on NetBeans Forums as I was interested in knowing how to get started with building NetBeans Platform. So, I will be sharing the steps I followed that made my work easy.

### Getting Started

Well, I have downloaded the source code for NetBeans Platform 6.X, as well as two JDK’s [1.5.0_22 - 64bit,  1.6.0_18 - 32bit] on Windows 7 – 64bit OS.  Assuming ANT_HOME, JAVA_HOME set properly and added to PATH.

It’s not necessary that you download the same JDK’s, however it’s necessary to have a copy of JDK 5 and 6. Because some versions of NetBeans code are built using JDK 5, while v6.8 can be built using JDK 6.

### Steps To Be Followed

1. Extracted the source code of NetBeans Platform 6.X under MyRCP\NbRcp_6X on my OS.
2. cd some\path\to\MyRCP\NbRcp_6X
3. cd nbbuild
4. ant -Dcluster.config=platform build-platform -Dnbjdk.home=”%JAVA_HOME%”
OR
ant -Dcluster.config=platform build-platform -Dpermit.jdk6.builds=true
5. Zip the netbeans directory created under MyRCP\NbRcp_6X\nbbuild directory and extract it wherever necessary/version-control the netbeans directory.

There you go, you have build your own RCP. Go, get started by adding the newly built platform in your NetBeans 6.X Platform Manager.

# taT | Hacking Modules..

Ever wondered, apart from extending the NetBeans IDE, or some application based on NetBeans Platform. What else can be done with the module?

### Brief Overview

Well, NetBeans IDE provides Module Development Support by providing 4 kinds of Project Templates;

1. Module
2. Module Suite
3. Library Wrapper Module
4. NetBeans Platform Application

I have some knowledge of the first two, so we will stick to them for the rest of this post. So, lets have a look at the simplistic module structure;

This is what you see when you expand the Project node in Files View. We will focus on platform.properties, project.xml. If you switch to the Project View, you would see the files with following names, visible under Important Files node.

#### NetBeans Platform Config

So, that’s basically the logical view of the file platform.properties. In the past, I have written some pretty useful tips and Tricks (contributed to NetBeans Community Docs) based on this file;

This is the logical view of the file project.xml. There’s one more useful tips and Tricks (contributed), that’s based on this file, which lets you add your module as friends to those modules, if you want your module to depend on the specification version of the same.

### Playing Tricks..

I will be making use of NetBeans 6.7 IDE. Although, these tricks should work well with NetBeans 6.x IDE. So, lets answer the question I asked in the beginning.. Generally, when you create Module project, you get an option to either create it as Standalone Module or Add to Module Suite.

#### Standalone Module

When you choose this option, you also get an option to select NetBeans Platform of your choice, along with Manage.. button. If you want to know more about that, refer this contribution.

Suppose, I choose NetBeans 6.5 Build (added with name as 65 in Platform Manager) as Platform and move ahead. I would be able to use 6.7 IDE to create module, targeted for NetBeans 6.5 IDE. The module’s platform.properties looks like this;

nbplatform.active=65

This would enable the running IDE to achieve the desired result, as mentioned above. Now, running the module will ofcourse launch NetBeans 6.5 IDE as Target Instance to see how your module works. This process might be slow, as you’re running full-fledged 6.5 IDE.

If your module doesn’t depend on clusters other than platform (which is by default). Then, you can tweak the file as follows;

enabled.clusters=\
platform
nbplatform.active=65

These clusters are bare-minimum essentials, that are enabled by default when you create the NetBeans Platform Application project using 6.5/6.7 IDE. The property enabled.clusters helps to enable only those clusters which are necessary to run this module.

Now, run your module and it will look like you’re running a NetBeans Platform Application having a single user-defined module. Here’s how module’s project.xml looks like;

<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>code.name.base.of.your.module</code-name-base>
<standalone/>
<module-dependencies>
<!-- Here are your module dependencies.. -->
</module-dependencies>
<public-packages/>
</data>
</configuration>
</project>

Note the bold-faced tag <standalone />, this tells the NetBeans IDE that your module is not part of any module suite. Its a standalone module, as you created.

If you decide to go with this option, you would then browse the filesystem to find the appropriate Module Suite project and then, move ahead.

In case of Module Suite projects, the enabled.clusters property automatically occurs/disappears, when you check/uncheck the modules and/or clusters from its Project Properties Wizard.

Note that the module, that becomes part of the suite, would use only those clusters which the suite has enabled. Along with that, suite-private.properties file is added under /nbproject/private. Also, take a look at the module’s project.xml;

<project xmlns="http://www.netbeans.org/ns/project/1">
<type>org.netbeans.modules.apisupport.project</type>
<configuration>
<data xmlns="http://www.netbeans.org/ns/nb-module-project/3">
<code-name-base>code.name.base.of.your.module</code-name-base>
<suite-component/>
<module-dependencies>
<!-- Here are your module dependencies.. -->
</module-dependencies>
<public-packages/>
</data>
</configuration>
</project>

Note the bold-faced tag <suite-component/>, this tells that NetBeans IDE that this module is part of a Module Suite project.

### Tips to Remember

You may convert your standalone module to become part of suite, or vice-versa. Just add/remove suite-private.properties (Per Suite Locator) file and tweak your Module’s project.xml and Module Suite’s project.properties.

Also, note that some changes have taken place in NetBeans 6.7 IDE, you may find out more over the web. One more thing, NetBeans 6.5 IDE added suite.properties file under /nbproject and had same tag as <suite-component/>. I think NetBeans 6.0 and 6.1 might do the same. Please try it yourself and let me know.

Stay tuned..

# #3 | Geertjan Blogs and Kenai

#### Dec, 2008

Nearly 6 months back,I had published 2nd part of the blog series, I started to share what I learnt while creating a project type. However, I couldn’t continue as I got busy with my internship commitments and engineering studies. I thought I would see many blogs after that from community side. I got few nods as well, but I am disappointed with them as they didn’t deliver.

#### May, 2009

I saw Geertjan wrote mini-blog-series (May, 2009) with code and hints on how to get started creating project type. That was really cool. Finally, it looked like my prayers were heard. Have a look at them;

Geertjan made use of NetBeans 6.7 daily builds for creating the prototype explained above. So, why not get started with these blogs?

#### June, 2009

I will soon continue with my exploration stopped long time back and will continue to post my learning in the coming months. Also, I have written a post in discussion forums to begin creating a project type.

Other News
Get to know more about my NetBeans plugins at Kenai and I also shared some tips and Tricks based on NetBeans Platform.

Come on, get started and share what you explore. Stay tuned for more..

# NetBeans Plugins at Kenai | #2

This post will focus on work flow of my plug in Revamped Hyperlink Navigation (RHN). Without much ado, lets get started..

#### Getting Started

Firstly, you need to access the existing sources available for plug in, published in Update Center for NetBeans 6.0 and then, I will use NetBeans 6.5 as the development software for demonstration. So, run NetBeans IDE (bundled with either Java SE, Java or All technologies).

#### Checkout Sources..

Open Versioning | SVN menu and select Checkout… from sub-menu. Checkout Wizard opens.. Now, enter Repository URL as https://kenai.com/svn/nbrcp-kolektiv~incubator/nbplugins/tags/release60_versions and click “Next >.

You might be prompted by the NetBeans to accept certificate, click on Accept Temporarily and continue.. Now, click on the Browse button to select the Repository Folder needed to be checkout. Select /rhn_v11/ahrefhyperlink.revamped and specify your Local Folder. Also, select the checkbox with label as Scan for NetBeans Projects after checkout and click Finish. NetBeans will prompt you to open project AhrefHyperlink (Revamped). Click Open Project and NetBeans will open the project for you. Now, right-click the project node and select Properties.

Reference Guide

http://www.netbeans.org/kb/60/ide/subversion.html#checking

#### Manage Platforms…

Now, goto Libraries and you will notice that NetBeans Platform selected for project is the default build provided by the NetBeans 6.5 IDE, and similarly for Java Platform. So, you need to configure the project to be built against NetBeans 6.0. Therefore, refer this tips and Tricks to learn how to “Manage Platforms…“. Also, choose JDK 1.5 for Java Platform (JDK 1.6 should also work fine).

#### See Module in Action..

Once you are done with it, click OK to save project properties. Now, Clean and Build the project and Run to see this module in action. If success, the NetBeans 6.0 splash screen pops up and soon, NetBeans 6.0 instance is running with the plug in, installed. Try out the cases specified in the tutorial and then, try out some new one’s from your side. Observe where it works and where it doesn’t.

If you find any issues/bugs, kindly file it using JIRA Issue Tracker used for this project and select component nbm-hyperlink. Soon, I will write wikis so as to help you understand how to file issues for this project. Fixed sources are stored under /nbplugins/branches as /release60_fixes/ahrefhyperlink.revamped (Links updated).

Unstable code is placed under /nbplugins/trunk and you may see what new developments take place there.

Stay tuned for more!

# taT | Managing NetBeans Platforms

Recently, I asked a question on NetBeans Developers Mailing List about gaining better understanding of managing NetBeans Platform(s) within the NetBeans IDE.

You didn’t knew that, right? Well, I have also recently discovered that there’s a provision to manage “NetBeans Platforms” for almost every NetBeans Module Project (I guess). Although, I think I knew that this feature was there but never actually devoted time to see what exactly it does.

Yesterday, when I re-discovered this feature and decided to give it a try. I started exploring it and then, faced some issues. So, I raised the above question on the mailing list. I did receive a reply, however it has a different approach to the above problem. Not directly related to scenario’s I came across. As I await more clarification

Now, I got clarification I needed and indeed it should help me understand the way, NetBeans works in this scenario. I thought why not share this scenario with you people. Maybe, you might have faced same issues.

So, how exactly we make use of this feature? Just follow the steps and let me know, what did you observe?

## Here are the Tricks,

Firstly, run NetBeans IDE (bundled with either Java SE, Java or All technologies). I am using NetBeans 6.5 FCS for demonstration.

Now, goto Tools | NetBeans Platforms and generally, you would find same platform configured with your NetBeans IDE and that might be possible, only if you are not running any daily builds.

So, this figure might look familiar to you, if the above statements are correct. You can configure several platforms with your distribution. For instance, I have NetBeans 6.0, 6.1 installed, along with 6.5 which I am running. So, I will show you how to configure one of them,

Choose Platform Folder

This step will let you select the installation directory of other NetBeans distributions and let you configure the platform supplied by them.

Platform Name

You may edit the Platform Name as per your need, or keep defaults and click Finish.

This way you have added platform supplied by NetBeans 6.0 in NetBeans 6.5. Now, switch over to Harness tab and click the 2nd radio button to complete the configuration. This is done to let this platform use its harness to perform tasks related with module projects.

Similarly, doing for 6.1, the following figure shows that I have successfully configured the above NetBeans Platforms,

Now, you know how to add/remove NetBeans Platforms. Lets go further ahead and explore a bit more by taking a typical scenario..

## and some tips,

Assuming you made a plug in using NetBeans 6.0 (released in Dec ’07) to be compatible with the same. Soon after NetBeans 6.5 FCS (released Nov ’08) was available, you find that 6.5 work very fast compared to 6.1 and due its improved features, it will help you in reducing your development time.

So, you decide to rework on your module using latest features, however you still want that plug in to work only for NetBeans 6.0, here’s what you need to do.

Firstly, open your plug in project and right-click project node to select its properties. Now, goto Libraries and you would see there’s a drop-down list for selecting your choice of NetBeans Platform, against which you can build your module. This list of platform’s can be configured by clicking “Manage Platforms…” button and you will see the same image, shown earlier.

See how they are all related.. Isn’t it cool? By default,  the platform supplied by the NetBeans IDE you are running is selected.

Here’s one thing to keep in mind, that as you are reworking on an old project like this, you must make sure that you configure the NetBeans Platform for it with care, as not doing so will result in failing the build and adding irrelevant versions of module dependencies.

In our case, if you have configured NetBeans 6.0 as demonstrated above, you need to select that from drop-down list and then, select NetBeans 6.0 build to let your module perform tasks against platform supplied with NetBeans 6.0.

When, you run the module project, the above splash screen for NetBeans 6.0 pops up and now, you can see whether your module works or not. Hope this helps!

This blog has been contributed to NetBeans Community Docs Program and for latest updates on this content, refer to the contribution.

Acknowledgements

Thanks to Tom Wheeler (NetBeans Dream Team Member and NetBeans Governance Board Member) for answering my question on the mailing list.