Other Utilities
NbBundle
for internationalization
There is a single setting for the module under Project Settings |
API Support which permits you to use the API-supplied NbBundle
class for finding resource bundles. The use of NbBundle
will be supported
when the I18N and Form modules are installed--then when performing automatic localization
of a file; inserting localized strings; or using the localization-aware property editor for
text properties in the Form Editor, the generated code will make the correct calls to
NbBundle
rather than to ResourceBundle
. The lookup is done implicitly
by the class, not by an explicit resource path, so you should make sure there is a properties
file named Bundle
in the same package as the localized code.
Note: you must explicitly enable this option to use it.
Javadoc on objects
If you right-click on any Java source in the Explorer,
as well as things with instance cookies (which includes
serialized files, many Bean Browser nodes, and many objects under Project
Settings and Global Settings); and the object represented
by this node is in the Open APIs (or some superclass /
superinterface is), then Tools |
Javadoc: classname will display the Javadoc for that
API class in the internal Web browser. This is a handy way to get a
quick reference on how this MultiFileLoader
you are
writing is supposed to work.
Installable File Helper
Note: this tool has been largely superceded by XML layers.
This tool makes it easier to make fancy templates for your module,
and also make display names for any files in the system file system.
It is enabled in the Tools... popup menu of any file which is
currently set to be a template, and all folders. When it is selected, it will pop up a
dialog containing the property sheet for that file, plus an extra tab
for information the helper adds. There are three properties you can look
at and set related to the template wizard:
- Sequence of Panels lets you set an alternate sequence
of panels in the New from Template wizard, permitting you to arbitrarily
customize the handling of your template's instantiation. This is a very powerful
capability, especially for complex or difficult-to-configure templates. To use
this property, you must first write an "iterator" describing how the wizard
should treat your template. To do this, create an implementation of
org.openide.loaders.TemplateWizard.Iterator
(see the API documentation
for details on what it should contain), and compile this code.
Now in the helper property, you can type in the class name of your implementation,
or browse to it with the ... button and select the class you wish to use.
You may also create a serialized JavaBean prototype of the implementation using
Customize Java Bean, then browse to this serialized form instead.
- Description URL lets you associate a Web page with the template as a
description which will be shown in the first panel of the wizard, and will help your
users determine what the template does. Just type in a URL.
Usually the URL will be of the form nbrescurrloc:/path/to/myhelp/description.html
,
which is a special URL that will automatically look for that resource inside your
module and also localize it if needed. As a shortcut to typing in such a URL,
just click ... to browse to the description file
in the Filesystems tab.
Warning: it is not possible to use a nbrescurrloc:
URL from
NetBeans 3.0 as these URLs were introduced later. If you wish to set description
URLs it is recommended you use a later build.
To remove any of these associations, right-click on the property name and choose
Restore Default Value or click Default in a custom editor.
There are also two properties which can help you set a localized display name
for any installable files (templates, menu folders, bookmarks, Component Palette
items, etc.). Note that this capability is not specified in the
Open APIs and is present only in the NetBeans implementation of the system file system
(not any user-mounted file systems). The properties are:
- Localizing Bundle shows the bundle used to localize the given
file, if any. It is specified as a dot-separated abstract path (i.e. the actual
resource path is computed based on the current locale). While using the tool, the
bundle may be in the Repository, but it must be installed into the system classpath
or a module at deployment time, or the localization will not work. You may choose
... to browse to a bundle file, or type in the name.
- Localized Name (currently read-only for simplicity) shows the current
localized name of the file according to its bundle, if any. The localized name is set
by means of there being a key in the bundle with the same name as the file's full
resource path, e.g.
Palette/Beans
(a directory) or Palette/Beans.ser
(a file). In the case of forms and other multi-file objects, only the primary file (*.java
)
need be specified.
There is also a tool to generate the bundles for a number of localized files at once.
First set the bundle path for all files (and directories) you will want to localize.
(The quick way is to expand all the paths in the Helper window, click and shift-click to
select all the nodes, then set the Localizing Bundle property on all of them
at once.) Now select a file, or several, or a whole directory--in the context menu is
Generate bundle .... The action will show in the Output Window what it is
doing--it will add keys for the selected file(s) to the proper bundle (only in the default
locale), where the values will be the same as the file names (i.e. the localization will
not yet affect display). Then you can edit the bundle to use different names and watch
the effects on the Localized Name property (after saving).
Back to Contents