Wednesday, November 17, 2010

NetBeans Growl notifications

Demo time

This plugin provides Growl integration with NetBeans. If you are using NetBeans on OSX and you have Growl, download my plugin.

As a proof of concept builds are shown but all other notifications that usually would have appeared using the default implementation are now posted via Growl.

Complex UIs trigger just a simple notification and then display a dialog when clicked with the actual custom components (obviously one can't publish custom Swing components in a Growl popup).

Speaking of complex UIs, some custom components are just JLabels that simulate hyperlinks so I would say those might be migrated to a normal text and ActionListener.


One thing that NetBeans needs is OS-aware notifications and my two focused OSes are Ubuntu and OSX.

On Linux we have the Desktop Notifications Specification, which is a very clean, D-BUS based specification for desktop-wide notifications.

Ubuntu extends and modified the specification a bit as well as define a quite nice design guideline document.

Growl defines the OSX notification standard which is generally similar to the Ubuntu version. Their documentation provides a nice overview of their API.

NetBeans on the other hand has its own notification API in the via the OpenIDE AWT NotificationDisplayer API.

The problem is that all these are disconnected, but rather similar given the nature of the problem they are trying to solve.

What I think NetBeans is missing on OSX is a proper Growl bridge. Also, the NetBeans API should be modified to discourage custom components as those aren't easy to bridge to something else.


It's rather hard to find Java bindings for Growl as the official implementation is deprecated.

Next, I was able to find Grrrowl by Sonatype, which uses native code (via HawtJNI) and seems to be originally part of IntelliJ. There's also a fallback implementation to AppleScript which is nicely provided as pure Java scripting engine on an Apple JVM.

The problem with Grrrowl is that while it does display notifications quite nicely, it doesn't support any click handlers, so we won't be able to respond to user interaction.

The best implementation seems to be a very low-profile implementation by Michael Stringer, posted as stringbean on CocoaForge.

Michael Stringer's version uses actual JNI and provides a click handler. This is what my implementation uses.

Obviously, it only works on OSX, specifically, Intel-based OSX (because that's what I used to build the native code).

Let me know what do you think about it.

No comments:

The case of the different jsch 0.1.54 binaries

As part of the Apache NetBeans IP clearance we are combing through all the code and dependencies. One interesting thing we bumped into wa...