The Property Files

jEdit maintains a list of properties, which are name/value pairs used to store human-readable strings, user settings, and various other forms of meta-data. During startup, jEdit loads the default set of properties, followed by plugin properties stored in plugin JAR files, finally followed by user properties.

Some properties are used by the plugin API itself. Others are accessed by the plugin using methods in the jEdit class. Others are accessed by the scripts used by plugin packagers [3].

Property files contained in plugin JARs must end with the filename extension .props, and have a very simple syntax, which the following example illustrates:

# Lines starting with '#' are ignored.
name=value
another.name=another value
long.property=Long property value, split over \
    several lines
escape.property=Newlines and tabs can be inserted \
    using the \t and \n escapes
backslash.property=A backslash can be inserted by writing \\.

Now we look at a fragment from the QuickNotepad.props file [4] which contains properties for the QuickNotepad plugin. The first type of property data is information about the plugin itself; these are the only properties that must be specified in order for the plugin to load:

# general plugin information
plugin.QuickNotepadPlugin.activate=defer
plugin.QuickNotepadPlugin.usePluginHome=true
plugin.QuickNotepadPlugin.name=QuickNotepad
plugin.QuickNotepadPlugin.author=John Gellene
plugin.QuickNotepadPlugin.version=4.5
plugin.QuickNotepadPlugin.docs=QuickNotepad.html
# depends on jEdit 4.5
plugin.QuickNotepadPlugin.depend.0=jedit 04.05.99.00
plugin.QuickNotepadPlugin.description=A demo jEdit plugin that provides a notepad dockable.
plugin.QuickNotepadPlugin.longdescription=description.html

These properties are each described in detail in the documentation for the EditPlugin class and do not require further discussion here.

Next in the file comes a property that sets the title of the plugin's dockable window. Dockable windows are discussed in detail in the section called “The dockables.xml Window Catalog”.

# dockable window name
quicknotepad.title=QuickNotepad

Next, we see menu item labels for the plugin's actions. All of these but the first are defined in actions.xml file, and that is because the dockable itself has its own actions. Actions are discussed further in the section called “The Actions.xml Catalog”.

# action labels
# Dockable label
quicknotepad.label=QuickNotepad
# Additional strings extracted from the plugin java source
quicknotepad.choose-file.label=Choose notepad file
quicknotepad.save-file.label=Save notepad file
quicknotepad.copy-to-buffer.label=Copy notepad to buffer

Next, the plugin's menu is defined. See the section called “The QuickNotepadPlugin Class”.

# application menu items
quicknotepad.menu.label=QuickNotepad
quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
  quicknotepad.save-file quicknotepad.copy-to-buffer

We have created a small toolbar as a component of QuickNotepad, so file names for the button icons follow:

# plugin toolbar buttons
quicknotepad.choose-file.icon=Open.png
quicknotepad.save-file.icon=Save.png
quicknotepad.copy-to-buffer.icon=Edit.png

The menu item labels corresponding to these icons will also serve as tooltip text.

Finally, the properties file set forth the labels and settings used by the option pane:

# Option pane labels
options.quicknotepad.label=QuickNotepad
options.quicknotepad.file=File:
options.quicknotepad.choose-file=Choose
options.quicknotepad.choose-file.title=Choose a notepad file
options.quicknotepad.choose-font=Font:
options.quicknotepad.show-filepath.title=Display notepad file path

# Initial default font settings
options.quicknotepad.show-filepath=true
options.quicknotepad.font=Monospaced
options.quicknotepad.fontstyle=0
options.quicknotepad.fontsize=14

# Setting not defined but supplied for completeness
options.quicknotepad.filepath=

PropertySideKick

There is a SideKick for Property files, provided in the JavaSideKick plugin. This gives you a compact and sorted tree view of property files.

Localization Files

In addition to property files ending in .props, you will find property files with the names like lang_de.properties. Each of these files provides localized strings for a particular locale. In the example above, it is for the German locale. These files are loaded by jEdit automatically when that locale is in use. They need to have a different filename extension from the other property files so they can be treated differently from the regular properties.



[3] See the Macros/Properties/Create Plugin Announcement macro for an example.

[4] Examine the actual file for a more complete example