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

screenshot

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
clipboard
Join literals vs. Split on linebreaks
splitonlinebreaks

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

[2] http://plugins.netbeans.org/plugin/47589/additional-hints
[3] https://github.com/markiewb/nb-additional-hints
[3] http://hg.netbeans.org/main/contrib/file/tip/editor.hints.i18n

Advertisements

NetBeans IDE: Verification of plugins and update center URLs for non-verified plugins

You developed a cool NetBeans plugin? Now you want it be to be available via the official update center, so that it can be installed directly from the NetBeans IDE via the built-in Plugins Manager and gets more attention from the users?

Then you have to adhere to the verification and quality rules defined in [1] and [2]. You have to define a license, sign the package and so on. Your plugin will also be tested from several trusted community members and they give a go or a no-go. For some plugin developers this process seems to be too much overhead and too time-consuming. They do not request a verification and therefore their plugin is not available in the Plugins Manager from your IDE. That is a pity, because this way you miss many useful plugins (Geertjans plugins, Compare to clipboard, JVisualVM samples, …). For example there are only 67 of 136 plugins verified for NB 7.2.

Of course you could download the plugin manually from the plugin portal at [3] and install them manually, but this not very comfortable IMHO. It is also not reasonable for me to contact all the authors and beg them for getting their plugins verified. So i opened a ticket [4] for an update center which contains those non-verified plugins. And guess what. The NB team now provides such URLs:

As warning: Using these URLs you are going to install non-verified, experimental and non-quality-checked plugins, which could make your NetBeans IDE unstable/slow down or even crash. Only install plugins you know and trust. You can be sure that the NetBeans developers will not support any issues regarding these plugins.

You want to have more quality plugins available and don’t want to go this inofficial way of experimental update centers? So please encourage the authors of your favorite plugins to request a verification. Thank you!

[1] http://wiki.netbeans.org/FaqPluginRequirements
[2] http://wiki.netbeans.org/PluginPortalQualityCriteria
[3] http://plugins.netbeans.org/
[4] http://netbeans.org/bugzilla/show_bug.cgi?id=225104
[5] http://deadlock.netbeans.org/hudson/job/nbms-and-javadoc/lastStableBuild/artifact/nbbuild/nbms/updates.xml.gz

Updated NetBeans plugin “Show path in title” and project groups

It was a very productive weekend, so here again another short note about a plugin update as a result. I extended my popular plugin “show path in title” to show the name of current project group too. (It was simple after some investigations i documented at [1].)

You do not know what “project groups” are? They are a mix of an eclipse workspace and a working set. This NetBeans feature IMHO is underestimated. Have a look at the following blogs for some more kudos [2], [3] and [4].

FYI: There is also a good old plugin from Aljoscha Rittner at [5] which allows you to switch the group right from the toolbar.

Now back on topic: The plugin can be downloaded manually at the plugin portal [6] (for versions from 6.9 up to 7.3). The plugin is also verified for NB 7.2, so it can be downloaded from the plugin dialog in your IDE. Feel free to give feedback and feature/bug reports.

New NetBeans plugin: “Sort line tools”

Only a short note today. I repackaged the good old Line Tools plugin from sandipchitale and made it compatible to NB 7.x as good as i could. Because of some exceptions at runtime i had to disable some of the known features. But nonetheless it is still useful.

What’s left? Well, some actions and a toolbar for the editor which allow you to

  • Sort lines spanned by selection in ascending/descending (in-)case-sensitive order
  • Remove duplicate lines while sorting.

1357991789_screenshot[3][1]

The plugin can be downloaded manually at the plugin portal http://plugins.netbeans.org/plugin/45925/line-tools-nb-7-x-compatible. The plugin is also verified for NB 7.2, so it can be downloaded from the plugin dialog in your IDE.

New NetBeans-plugin: “Toggle line wrap”

I implemented another easy plugin, which adds a status bar button and an action which allows to toggle the line wrap setting. You do not have to use the options dialog and you can assign a shortcut for it. It is compatible to NetBeans >7.0

screenshot[1]

More details and download at http://plugins.netbeans.org/plugin/45663/?show=true (sourcecode is also available).

In a few days it will also be available the at NetBeans IDE Update Center and you can install it from within your IDE. Stay tuned.

New NetBeans-plugin: “Close Other Projects”/”Close All Projects”

I created another small plugin to extend the NetBeans IDE with RFE #190839 and #221151. I know this type of plugin already existed in the past, but the old one (https://blogs.oracle.com/gridbag/entry/netbeans_module_close_other_projects) was unmaintained and unavailable for newer versions of NetBeans IDE.

Get it from http://plugins.netbeans.org/plugin/45122/?show=true.

In a few days it will also be available the at NetBeans IDE Update Center and you can install it from within your IDE. Stay tuned.