Mass Format in NetBeans IDE 7.2

Prior to the upcoming 7.2 release, the Source | Format menu item would be disabled, unless the currently selected window was an editor document.

In 7.2, you can select any of these:

  • project node
  • Source Packages node
  • package node
  • folder node

And you can also select multiple nodes, from various kinds, of the above. You'll then see that Source | Format is enabled and functions as you might expect:

When the action is invoked everything within the selected nodes is formatted as defined by the rules defined in the Options window.

Related issue:


Will this format java sources, xml, jsp/jsf at the same time?

Posted by alex on May 11, 2012 at 06:43 AM PDT #

Yes, uploading a movie to YouTube right now to illustrate this and will then paste it inside this blog!

Posted by Geertjan on May 11, 2012 at 07:25 AM PDT #

Nice. I've been waiting for this feature since version 6

Posted by rio on May 11, 2012 at 07:40 AM PDT #

is there a similar feature for the "fix imports" and for the @Override annotations?

Posted by ric on May 13, 2012 at 12:57 AM PDT #

You can use the Inspect and Transform feature, available from version 7.1

Right click on a package > Refactor > Inspect and Transform, then use the "Organize Imports" & "Add @Override Annotation" option

Posted by rio on May 13, 2012 at 10:21 PM PDT #

Can this be done via command line? I would like to put this into my git hooks.

Posted by Mike on April 29, 2015 at 03:20 PM PDT #

Posted by Geertjan on April 29, 2015 at 03:21 PM PDT #

Post a Comment:
  • HTML Syntax: NOT allowed

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.


« November 2015