/www/tags/NOV_07_2009/htdocs/42docs/users-guide/plugin-implement-properties.html
HTML | 91 lines | 89 code | 2 blank | 0 comment | 0 complexity | fac78af4c13ec387101fbccb7d63a920 MD5 | raw file
Possible License(s): BSD-3-Clause, AGPL-1.0, Apache-2.0, LGPL-2.0, LGPL-3.0, GPL-2.0, CC-BY-SA-3.0, LGPL-2.1, GPL-3.0, MPL-2.0-no-copyleft-exception, IPL-1.0
- <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>The Property File</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="jEdit 4.2 User's Guide"><link rel="up" href="plugin-implement.html" title="Chapter 18. Implementing a Simple Plugin"><link rel="previous" href="plugin-implement-editbus.html" title="The EditBus"><link rel="next" href="plugin-implement-actions.html" title="The Action Catalog"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">The Property File</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="plugin-implement-editbus.html">Prev</a> </td><th width="60%" align="center">Chapter 18. Implementing a Simple Plugin</th><td width="20%" align="right"> <a accesskey="n" href="plugin-implement-actions.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="plugin-implement-properties"></a>The Property File</h2></div></div><div></div></div><p>
- jEdit maintains a list of “<span class="quote">properties</span>”, 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.
- </p><p>
- Some properties are used by the plugin API itself. Others are
- accessed by the plugin using methods in the
- <a href="../api/org/gjt/sp/jedit/jEdit.html" target="_top">
- <tt class="classname">jEdit</tt></a>
- class.
- </p><p>
- Property files contained in plugin JARs must end with the filename
- extension <tt class="filename">.props</tt>, and have a very simple syntax,
- which the following example illustrates:
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># 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 \\.</pre></td></tr></table></div><p>
- Now we look at the <tt class="filename">QuickNotepad.props</tt> 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:
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># general plugin information
- plugin.QuickNotepadPlugin.activate=defer
- plugin.QuickNotepadPlugin.name=QuickNotepad
- plugin.QuickNotepadPlugin.author=John Gellene
- plugin.QuickNotepadPlugin.version=4.1
- plugin.QuickNotepadPlugin.docs=QuickNotepad.html
- plugin.QuickNotepadPlugin.depend.0=jedit 04.02.10.00</pre></td></tr></table></div><p>
- These properties are described in detail in the documentation for the
- <a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">
- <tt class="classname">EditPlugin</tt></a> class
- and do not require further
- discussion here.
- </p><p>
- Next in the file comes a property that sets the title of the
- plugin's dockable window. Dockable windows are discussed in detail
- in <a href="plugin-implement-dockables.html" title="The Dockable Window Catalog">the section called “The Dockable Window Catalog”</a>.
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># dockable window name
- quicknotepad.title=QuickNotepad</pre></td></tr></table></div><p>
- Next, we see menu item labels for the plugin's actions.
- Actions are discussed in detail
- in <a href="plugin-implement-actions.html" title="The Action Catalog">the section called “The Action Catalog”</a>.
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># 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</pre></td></tr></table></div><p>
- Next, the plugin's menu is defined. See
- <a href="plugin-implement-quicknotepadplugin.html" title="The QuickNotepadPlugin Class">the section called “The QuickNotepadPlugin Class”</a>.
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># application menu items
- quicknotepad.menu.label=QuickNotepad
- quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
- quicknotepad.save-file quicknotepad.copy-to-buffer</pre></td></tr></table></div><p>
- We have created a small toolbar as a component of QuickNotepad, so
- file names for the button icons follow:
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># plugin toolbar buttons
- quicknotepad.choose-file.icon=Open.png
- quicknotepad.save-file.icon=Save.png
- quicknotepad.copy-to-buffer.icon=Edit.png</pre></td></tr></table></div><p>
- The menu item labels corresponding to these icons will also serve as tooltip
- text.
- </p><p>
- Finally, the properties file set forth the labels and settings
- used by the option pane:
- </p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># 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=</pre></td></tr></table></div><div class="sidebar"><p class="title"><b>Updating 4.1 plugins</b></p><p>
- jEdit 4.2 plugins are distinguished from jEdit 4.1 plugins by the presence of the <tt class="literal">plugin.<i class="replaceable"><tt>name</tt></i>.activate</tt> property. If this property is set, the plugin is treated like a jEdit 4.2 plugin. Usually, this property should be set to <tt class="literal">defer</tt>. See the API documentation for the <a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">
- <tt class="classname">EditPlugin</tt></a> class for details.
- </p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="plugin-implement-editbus.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="plugin-implement.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="plugin-implement-actions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The EditBus </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The Action Catalog</td></tr></table></div></body></html>