NetBeans IDE: Additional hints plugin to simplify the work with String literals

Recently I wrote some Java hints, which simplify the work with String literals. Users of Eclipse or Intellij IDEA may recognize some of them.

New hints:

  • Replace ‘+’ with ‘MessageFormat.format()’
  • Replace ‘+’ with ‘new StringBuilder().append()’
  • Replace ‘+’ with ‘String.format()’
  • Join literals
  • Copy joined literals to clipboard
  • Split the String on linebreaks


Here some use-cases:

Use-case 1: “Simplify concatenation”
"Hello " + "world" can be replaced by "Hello world"

Use-case 2: “Join for localization”
When localizing your application, you often have to struggle with concatenated Strings like the following:

"Info: only " + number + " entries found"

With the help of the hints such terms can be easily replaced by

String.format("Info: only %s entries found", number) //or 
MessageFormat.format("Info: only {0} entries found", number)

The generated joined literals can now be extracted more easily by the Internationalization wizard/tooling.

Use-case 3: “Developing test-cases for hints”

Copy joined literals to clipboard vs. pasting from clipboard
Join literals vs. Split on linebreaks

The plugin is compatible to NetBeans 7.2 (and above) and verified, thus it can be installed directly from your IDE. Or you can download it from [1] and install it manually.

The sourcecode is available at [2]. The infrastructure code is based on code from the “I18N Checker” plugin from Jan Lahoda [3]. Feel free to file issues or enhancements at [2].


NetBeans IDE: Improved documents tabs in nightly builds

NetBeans 7.3 is only some days old, but the NB devs are not tired to continue making NetBeans IDE even better. There are already many visible changes in the current nightly dev builds regarding usability.

For example: Documents tabs were rewritten from the scratch – see [1]. Kudos to Stanislav Aubrecht. There are highly configurable now and the UI looks very clean.





Notable features

  • you can have a tab row for each of your open projects, even with coloring
  • you can show the parent folder of the current file in the tab. This feature seems to be requested by PHP devs, who work with many opened files equally named index.php from different folders at the same time. Those can be distinguished now.
  • status label decorators from the version system are applied to tab too
  • the documents dropdown is now grouped by project

It looks very promising. Stay tuned for more useful enhancements in the next version!