Emilian has posted 6 posts at DZone. View Full User Profile

NetBeans Growl Notifications

11.17.2010
| 3471 views |
  • submit to reddit

 

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).

[NOTE: This is the place you would see a video, but DZone doesn't allow me to embed it. So either view the attached SWF or open my blog with this same article and a functional video].

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.

Background

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.

Implementations

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.

Legacy
Article Resources: 
Published at DZone with permission of its author, Emilian Bold.

(Note: Opinions expressed in this article and its replies are the opinions of their respective authors and not those of DZone, Inc.)

Comments

Hantsy Bai replied on Thu, 2010/11/18 - 12:53am

Eclipse Mylyn has the same feature for task notifictaion, but it can works in all OS platform.

Emilian Bold replied on Thu, 2010/11/18 - 3:56am in response to: Hantsy Bai

Well, NetBeans also has a notification API that's pure Java/Swing so it's crossplatform. But I like Growl since it's a central place to see notifications and I want my IDE to also use that. I'm not certain Mylyn has an actual Growl bridge. They probably have something they rolled on their own.

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.