The Property File

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.

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 the QuickNotepad.props file 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.name=QuickNotepad
plugin.QuickNotepadPlugin.author=John Gellene
# depends on jedit 4.3pre3
plugin.QuickNotepadPlugin.version=04.02.99.00
plugin.QuickNotepadPlugin.docs=QuickNotepad.html
plugin.QuickNotepadPlugin.depend.0=jedit 04.02.10.00

These properties are 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. Actions are discussed in detail in the section called “The Actions Catalog”.

# action labels
quicknotepad.label=QuickNotepad
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=