Saturday Mar 26, 2016

Skeleton Node Hierarchy with Login on GitHub

The series continues with a login scenario:

Here's what you get, initially the same as last time, though this time no child nodes are available. Right-clicking on the node brings up the popup menu below:

When clicking on the popup menu, the dialog below is shown:

And, finally, if, and only if "foo/bar" is the "user/password", a new first level node is created in the hierarchy, together with all the children of the first level node. Here you can see that two first level nodes have been created.

How it works is that Preferences are created in the login dialog, while a PreferenceChangeListener is set on the Leve1ChildFactory.

Friday Mar 25, 2016

Skeleton Node Hierarchy for Databases on GitHub

Continuing the series, here's a starting point for node hierarchies that need to be plugged into the Databases node in the Services window:

It looks as follows:

Here's the most important part of the source structure:

Thursday Mar 24, 2016

Skeleton Node Hierarchy with Progress Handling on GitHub

The same as yesterday, a skeleton node hierarchy, though this time different progress handling solutions are included:

In Level1ChildFactory, keys are created like this, which causes the application to grey out and the application becomes modal during the processing:

protected boolean createKeys(final List list) {
    BaseProgressUtils.showProgressDialogAndRun(new Runnable() {
        public void run() { during
            try {
            } catch (InterruptedException ex) {
    }, "Processing Level 1...");
    return true;

In Level2ChildFactory, a different approach is provided, which kicks off the progress bar:

protected boolean createKeys(List list) {
    String msg = "Processing Level 2...";
    ProgressHandle handle = ProgressHandleFactory.createSystemHandle(msg);
    try {
    } catch (InterruptedException ex) {
    return true;

In Level3ChildFactory, the default behavior, when "true" is passed into the ChildFactory call, is that the cursor turns into a spinning busy icon, while no progress bar of any kind is shown:

protected boolean createKeys(List list) {
    try {
    } catch (InterruptedException ex) {
    return true;

Wednesday Mar 23, 2016

Skeleton Node Hierarchy on GitHub

Sometimes handy to have a node hierarchy all set up and ready for you to incorporate your own content.

Well, here it is:

In the Services window, it produces this simple result:

The structure is as follows:

Tuesday Mar 22, 2016

ProjektMotor Blueprint Infrastructure for Extending NetBeans in JavaScript

A key problem for JavaScript developers using NetBeans IDE is that they need to know Java if they want to extend it.

For example, let's say you want to extend NetBeans IDE to provide code completion for Oracle JET components, such as a gauge. Hard enough to do that if you're a Java developer. Now imagine you're a JavaScript developer, getting to this point, i.e., implementing various NetBeans APIs, is impossible without knowing Java:

Moreover, since you don't simply want essentially a code template, but a dialog-driven set of GUI components, such as the below, life becomes even harder for the poor JavaScript developer trying to extend NetBeans IDE:

Having read the above and looked at the images, you're now ready to appreciate what ProjektMotor in Leipzig, Germany is working on: a project called "Control-Space". The project provides a blueprint infrastructure, enabling a JavaScript developer to define the code completion, as well as the GUI component that you see above, in JavaScript, as shown below:

The above is a Control-Space Blueprint, defining code completion in an HTML file for loading an HTML file named "gauge.html", which will be pasted into the HTML file at the cursor, after the dialog is completed. Support has been added as well for generating the corresponding JavaScript side. Essentially the above is a JavaScript DSL on top of the corresponding NetBeans APIs, which are all of course in Java.

Similarly, in addition to code completion extensions defined in JavaScript, you can use JavaScript to define new Nodes in a Blueprint Explorer window which, when clicked, can do anything you like, e.g., open windows or editors, generate boilerplate HTML, all by means of JavaScript:

Another example... Blueprints for removing menus from the main menubar in NetBeans IDE, again handy for JavaScript developers to tweak on the fly their development environment:

The third type of Blueprint is a Blueprint for testing Blueprints, again expressed in JavaScript. 

Next, imagine Blueprints for defining hints and error markings in the JavaScript editor, expressed in JavaScript. And imagine being able to define Eclipse workspaces in NetBeans via JavaScript. I.e., anything you can do when extending NetBeans via Java you can do, in principle, assuming the applicable abstractions have been created, in JavaScript. 

Now imagine a Blueprint marketplace, where JavaScript developers can share/sell their Blueprints. Many possibilities flowing from there, I think, and basically NetBeans IDE becomes whatever your Blueprints define it to be. 

Interesting, isn't it? :-) 

Friday Mar 18, 2016

March, April, May: NetBeans Days Germany, India, UK

The following three months, you can join in with a NetBeans Day in the following places:

At the same time, NetBeans Days are being planned in at least the following locations:

  • Sao Paolo, Brazil
  • Paris, France
  • Cologne, Germany
  • Johannesburg, South Africa
  • Stockholm, Sweden.
Interested in getting involved or in setting up a NetBeans Day somewhere yourself? Simply set it up and start promoting it! Or leave a message here or feel free to contact me directly at geertjan dot wielenga at oracle dot com.

Thursday Mar 17, 2016

Part 6 of Couchbase & NetBeans Webinar

Here's the source code of the plugin for Couchbase in NetBeans:

And here's the latest webinar in the series with Arun and Eben from Couchbase:

Wednesday Mar 16, 2016

ContextAwareAction for Non-Indexed Couchbase Buckets

Let's take a look at how to implement an Action that will be visualized as a JMenuItem popup, which should only be displayed if a Couchbase bucket has not yet been indexed, so that it can be invoked to index the Couchbase bucket. Here you can see a non-indexed Couchbase bucket, with the "Set Primary Index" popup available:

Here, on the other hand, the JMenuItem popup is not available, since the bucket has already been indexed, hence it doesn't need to be indexed and the Action does not need to be, nor can it be, invoked:

Here's the code of the Action, hooked into the Node by overriding its "getActions(boolean)" method:

package org.netbeans.modules.couchbase.bucket;

import java.awt.event.ActionEvent;
import javax.swing.AbstractAction;
import javax.swing.Action;
import org.openide.awt.ActionID;
import org.openide.awt.ActionRegistration;
import org.openide.awt.DynamicMenuContent;
import org.openide.util.ContextAwareAction;
import org.openide.util.Lookup;
import org.openide.util.NbBundle.Messages;
import org.openide.util.Utilities;

        category = "Bucket",
        id = "org.netbeans.modules.couchbase.bucket.CreatePrimaryIndexAction"
        lazy = false,
        asynchronous = true,
        displayName = "#CTL_CreatePrimaryIndexAction"
@Messages("CTL_CreatePrimaryIndexAction=Set Primary Index")
public final class CreatePrimaryIndexAction 
        extends AbstractAction 
        implements ContextAwareAction {

    private final Bucket bucket;

    public CreatePrimaryIndexAction() {

    public CreatePrimaryIndexAction(Lookup context) {
        this.bucket = context.lookup(Bucket.class);
        N1qlQueryResult query = 
                                String.format("select * from system:indexes where keyspace_id = '" + 
                               + "'", 
        int size = query.allRows().size();
        if (size > 0) {
        } else {
        putValue(DynamicMenuContent.HIDE_WHEN_DISABLED, true);

    public void actionPerformed(ActionEvent ev) {
        String bucketName =;
                        String.format("create primary index on `" + 
                                bucketName + "`", 
        System.out.println("New primary index on: " + bucketName);

    public Action createContextAwareInstance(Lookup context) {
        return new CreatePrimaryIndexAction(context);


Tuesday Mar 15, 2016

Work Better with Cassandra 3 in NetBeans IDE

Quite a few people are involved now in different ways in the tooling support for Cassandra in NetBeans IDE.

A new release of the NetCassandraBeans plugin is now available, its main feature is that now Cassandra 3, as well as Cassandra 2 which was supported in the first release, is now supported:

Here's how the Cassandra node now looks (assuming you have Darcula installed), within the Databases node, while all the icons have been updated:

Want to help with this plugin? What's needed more than anything is for issues to be filed, either bugs or enhancement requests:

Monday Mar 14, 2016

RunStopSimulator: Complete Infrastructure for Simulator Software (Part 2)

In part 1, some years ago, the start/stop infrastructure was controlled from toolbar buttons. Let's now change that so that, instead, we use popup menu items to start/stop something, in this case a server:

The steps to providing the above start/stop infrastructure is as follows:

  1. Create Startable and Stoppable capabilities.
  2. Create NodeActions that are sensitive to the above capabilities.
  3. Hook the NodeActions into the "getActions" of the Node where they should be invoked.
  4. Add a CentralLookup to your module.
  5. Implement Startable and Stoppable in the Node and add/remove from the CentralLookup as needed.

All the code outlined above is here:

For example, here's the StartCassandraAction:

import org.openide.awt.ActionID;
import org.openide.awt.ActionRegistration;
import org.openide.nodes.Node;
import org.openide.util.HelpCtx;
import org.openide.util.NbBundle.Messages;
import org.openide.util.actions.NodeAction;

        category = "CassandraServer",
        id = "org.sim.start.StartCassandraAction")
        lazy = false,
        displayName = "#CTL_StartCassandraAction")
@Messages("CTL_StartCassandraAction=Start Server")
public final class StartCassandraAction extends NodeAction {

    protected void performAction(Node[] nodes) {

    protected boolean enable(Node[] nodes) {
        return CentralLookup.getDefault().lookup(Startable.class) != null;

    public String getName() {
        return Bundle.CTL_StartCassandraAction();

    public HelpCtx getHelpCtx() {
        return HelpCtx.DEFAULT_HELP;


The solution is elegant and idiomatic.

Saturday Mar 12, 2016

Lightweight & Fast NetBeans IDE

NetBeans IDE, how it looks for me is below, with Darcula look and feel, integrated JavaFX browser, Docker, and multiple carets (in the HTML file). The only plugin I've installed is Darcula, from the Plugin Manager under the Tools menu, all the rest is natively in NetBeans IDE. I've also removed the toolbar buttons to maximize screen real estate.

I'm using the "HTML5/JavaScript" download bundle of NetBeans IDE, which is small and fast, and includes the JRE.

Several of the features come from the latest development build, especially the multiple caret support. Get it here:

Friday Mar 11, 2016

Kubernetes, Node.js, Docker, NetBeans IDE

I worked through this Kubernetes document today and it worked well:

Here below (click to enlarge the image) you see my Node.js project in NetBeans IDE, showing the Docker file and Node.js file, together with Docker visualization in the Services window. From the Docker file, the Docker image can be built, after which it can be run, all from within NetBeans IDE. (Well, you need a development build for the next release of NetBeans IDE, available from the NetBeans Downloads page.)

Handily, NetBeans IDE has a built-in terminal, which I used a lot in this scenario:

At the end of the instructions, I had the Kubernetes Graphical dashboard up and running, showing me my Kubernetes-related data:

Finally, since I'm on Windows, I found this tip and this tip helpful for troubleshooting.

Thursday Mar 10, 2016

Couchbase Bucket Index Status in NetBeans IDE 8.1

Just did the 5th part of the Couchbase/NetBeans hacking session with Arun and Eben from Couchbase. We worked on visualizing whether a bucket is indexed or not, as shown below via small icons on the bucket nodes and a corresponding tooltip:

Here's how it looks with the Darcula look and feel which continues to be my favorite way to work with NetBeans IDE:

Here's the Couchbase announcements re the publication of this part of the series. Features being added are increasingly technical now!

Wednesday Mar 09, 2016

NetBeans Community at JavaLand 2016

NetBeans Dream Team members were well represented at JavaLand yesterday and today. Thomas Kruse and Kirk Pepperdine are not in the pic below, though they were at the conference, while in the pic you see Michael Mueller, me, Toni Epple, and Ivar Grimstad!

It was a great time and Toni suggested maybe next year there should be a NetBeans Community booth at JavaLand (and maybe other conferences too).

Tuesday Mar 08, 2016

Cassandra & Couchbase in NetBeans IDE

In NetBeans IDE 8.1, in a change especially useful with the Darcula plugin installed, the Cassandra and Couchbase plugins now have icons that look pretty good and that match/correspond with each other, while both are now found correctly within the Databases node:

If you want to get involved in the development of support for Cassandra and Couchbase in NetBeans IDE, here are the GitHub repos and please also feel free to add new issues for missing features:

Sunday Mar 06, 2016

Couchbase Status in NetBeans IDE 8.1

With Arun Gupta, I've been working on creating a NetBeans plugin for Couchbase. Arun's made webinars of each session we've done, the most recent one especially interesting if you want to learn about the Nodes API in the NetBeans Platform:

One thing we needed to do was move the Couchbase node within the Databases node, which is now done, as shown below: 

All the source code is here:

Give the NBM a try, get it here (though the Couchbase node will not be in the Databases node, i.e., not in the binary yet):

Saturday Mar 05, 2016

Five Steps to a Very Awesome Microservices Platform

From zero to a Very Awesome Microservices Platform is not much work.

  1. Get Docker. For me, on Windows 7, I used Docker Toolbox, using these excellent steps. I then had a lot of problems, relating to the Virtual Box installed by Docker Tools. Read this for related information about this problem. I then uninstalled Virtual Box, downloaded the latest version of Virtual Box, and installed it together with the "-msiparams NETWORKTYPE=NDIS5" argument. Next, after installation succeeded, I checked in "Network Connections" to make sure the "VirtualBox Bridged Networking Driver" had been selected.

  2. To make sure everything worked, I clicked on the "Docker Quickstart Terminal" on my desktop and ran this at its prompt:
    docker run hello-world
    The above worked and I got a message in the terminal.

  3. Then, get some Docker visualization tools, i.e., use NetBeans IDE 8.2, currently available as a development build, and then you'll be able to work with Docker Hub and related tools, as shown here:

  4. Now let's install VAMP. First, get the IP. In the "Docker Quickstart Terminal" on your desktop, run this:
    docker-machine ip

    Now you have an IP number, which you need in the next step.

  5. Read this page on the VAMP site. Then, in the Docker Quickstart Terminal, run this command (or the one applicable to your environment, as specified on the VAMP page), all on one line:
    docker run --net=host 
    -v /var/run/docker.sock:/var/run/docker.sock 
    -v $(which docker):/bin/docker 
    -v "/sys/fs/cgroup:/sys/fs/cgroup" 
    -e "DOCKER_HOST_IP=`put-docker-ip-here`" 

    The process takes a while. After it completes, you should now see this, automatically, in NetBeans IDE. In the screenshot below, I have selected the new nodes that have been added, to highlight them, i.e., you can now see your running VAMP container:

And now you're ready to use VAMP. Go to the URLs specified here in the VAMP documentation:

You also have Marathan set up, at the same time:

In next parts, we'll start using VAMP, now that we have it, together with its related tools, set up and ready to use.

Friday Mar 04, 2016

Very Awesome Microservices Platform

I met Olaf Molenveld from, creators of VAMP, during the last few days. VAMP is a very interesting project! I wrote a short article about it on JAXenter:

The complete article is here:

Thursday Mar 03, 2016

Docker Hub in NetBeans IDE

Rather than exploring Docker Hub on-line, you're able to make use of the Docker integration in NetBeans IDE. This is not in NetBeans IDE 8.1, instead use a development build for the next release. The Docker node is available in the Services window:

Many features are available after you right-click on the Docker node hierarchy:

For example, when you use the Pull command, you can search for Docker images, such as Docker images for NetBeans IDE:

More plans for Docker in NetBeans IDE are here:

Wednesday Mar 02, 2016

Yo OracleJET in NetBeans IDE 8.1

A simple plugin for NetBeans IDE 8.1 for those of us who like doing everything in NetBeans IDE 8.1, i.e., instead of using Yeoman on the command line, this lets you delegate the Yeoman task to NetBeans IDE:

Notice that both "blank" and "basic" are supported, i.e., the first generates the Oracle JET Base Distribution, while the second generates the Oracle JET Quick Start application.

Yeoman must be configured: 

The plugin is a work in progress. For example, currently, at the end of the process, even though the application is generated correctly and automatically opened, an error is thrown.

The source code is here, please fork and improve:

Note: The approach I took in YoNetBeans was wrong, I have a different way of achieving something similar now, and will be rewriting that plugin a bit soon.


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.


  • NetBeans IDE
« May 2016