I18N of NetBeans modules a bit easier
Just a small note: a NetBeans plugin written by Milos Kleint connects Java code and bundles with localization. Ctrl-Click to "MyClazz.someControl.text" in
NbBundle.getMessage(MyClazz.class, "MyClazz.someControl.text")
navigates you to the right line in the right bundle. Tooltip with the actual value of localized message is an other cool feature.
Just give the I18N hyperlinking plugin a try and download it from the NetBeans Plugin Portal.
(Despite the date no April Fools' Day Joke, I am sorry).
Posted at 05:21odp. IV 01, 2008 by Ondřej "Satai" Nekola in Java | Comments[0]
Default RequestProcessor in NetBeans can not cancel running Tasks
RequestProcessor is quite useful class for programming in NetBeans. You are not supposed to create your own threads (quite similar limitation is common for different managed environments such as application servers) and RequestProcessor.Task is quite comfortable (and a bit more high level) way to perform concurrent tasks.
The common pattern to use it is
RequestProcessor.Task myTask = RequestProcessor.getDefault().post(aRunnable)
This is a pretty good way, until you try myTask.cancel(). In such a situation, there are two possibilities. If the myTask has not started yet, it is canceled and will not be started ever. If it has already started, it is not interrupted.
So if you want to start some longer tasks and you would like to cancel even when already running, you must create your own RequestProcessor using this constructor with the (last) parameter interruptThread set to true.
Posted at 05:58odp. III 19, 2008 by Ondřej "Satai" Nekola in Java | Comments[1]