Netbeans JavaFX plugin experience – and what about IntelliJ Idea?

Warning: Many of the following criticisms are superficial, but I wanted to document my experience of learning a new IDE.  I’ll come back to this post in a year to see what’s changed.

I should also state, I’ve got nothing against the Netbeans editor itself, and respect how it is able to support all the new Java platforms and standards in line with their release to the public.  Because of this, it’s as easy to adopt a new sun-backed Java platform enhancement as it is in the .net world, and the support provided makes it easy to learn new Java technologies in both regular desktop and enterprise space.

So now for the whinge:

Trying out Netbeans 6.8 and its best of class JavaFx support left me a little disappointed.  Following the JFX tutorials was ok, but copying the code from the tutorial into the IDE was a little frustrating since the formatting would be all screwed up.  Organise Imports (CTRL+SHIFT+I) plus Format Source (ALT+SHIFT+F) become my new best friends.  Maybe its because I’m trying in a new IDE, but I dont remember having to do these things with Idea, imports would resolve (or prompt for resolve) on paste, and formatting would normally match the target source.  (I’m a spoilt IDE brat, lol)

The JavaFX palette left me wanting as well.  Sure I could drag and drop a template from the palette into my code, but like the copy and paste, it didn’t respect the formatting of my code.  Sure once the template was there, I could tab b/ween the fields within the object literal, but my first instinct is to make the code pretty and doing a Format Source.  Doing so meant that I could no longer tab between the elements.

It would be nice to have a visual guide as to where in the code you could drop a said palette template into (perhaps highlight code blocks yellow if it was within a content or def assignment, but orange if it was somewhere else in the scenegraph it didnt make sense).  This is because if you put the item in the wrong place, you have to spend a minute figuring out the order of ] and } in order to get a compiler fx class again.  The scenegraph should make it easy to identify which element belongs to what, but its easy to miss a line.

I’d also like to see elements which took a sequence (like content) but only had one element assigned to them (eg content: Rectangle { … }), become a group or a sequence automatically when items were dragged into them.  (eg: content: [ Rectange { … }, Circle { // i just added this } ]

I also found that CTRL+Space within an object literal to find the other properties didnt always seem to work.  As I got more experience with the IDE, I found this happening less.  I think the problem could have been to dragging and dropping in the wrong place, as soon as you have a syntax error in your code, the intellisense isn’t going to work, regardless if your CTRL+Space is just within the braces of the object literal.

Also in Netbeans, a lot of refactoring functions were neutered. Options like Move or Copy class or even create a variable (ALT+SHIFT+V) would prompt they didn’t work in the context of the file type.  Doing a block comment using the default comment keyboard shortcut (CTRL+SHIFT+C) didnt work, and its menu option under Format was greyed out, but you could press CTRL+I, type comment and select Toggle Comment for it to work there.  Strange.

End whinge

To Netbeans credit, the JavaFX preview is a great feature to help pick up the language, and of course the different profiles (Desktop, Common, Mobile) along with the integration with the the emulator is excellent.  The above things are pretty superficial and since Netbeans has the jump on the other IDE’s, will probably get around to addressing those other concerns later as the platform is adopted by more devs in future.

Many of the above criticisms are borne out of wanting more refactoring options and polyglot support like I’m used to in IntelliJ.  At present IntelliJ offers a mere syntax highlighting when opening Fx files, but thats about it.  What I’m really waiting for is the super refactoring options when working with a project that has Scala, Groovy and other facets.  As well as just being able to use the refactoring options that I’m used to (eg rename a var/class in java, and refs in the Groovy and scala get changed too).  However, those things aren’t automatic in IntelliJ, I appreciate those refactoring features would have to be developed specifically for JFX, just as they have been for Groovy and Scala.  The list of refactorings isn’t as wide as the java ones.

IntelliJ Idea

So what else can you do to get some java fx love in IntelliJ?  At present not much, you can compile & run JavaFX using Intellij using the External Tools function or by using the ant script as specified in the link.

There was a JavaFX plugin that was being developed by Brian Goetz back in 2008 but word on this has gone quiet.  In 2009 a blog was started by someone about writing a JFX plugin for idea but this too has gone quiet.

So its a case of watch this space.