PageRenderTime 123ms CodeModel.GetById 113ms app.highlight 7ms RepoModel.GetById 1ms app.codeStats 0ms

/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
 1<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>
 2  jEdit maintains a list of &#8220;<span class="quote">properties</span>&#8221;, which are
 3  name/value pairs used to store human-readable strings, user settings,
 4  and various other forms of meta-data. During startup, jEdit loads the
 5  default set of properties, followed by plugin properties stored in
 6  plugin JAR files, finally followed by user properties.
 7</p><p>
 8  Some properties are used by the plugin API itself. Others are
 9  accessed by the plugin using methods in the
10  <a href="../api/org/gjt/sp/jedit/jEdit.html" target="_top">
11  <tt class="classname">jEdit</tt></a>
12  class.
13</p><p>
14  Property files contained in plugin JARs must end with the filename
15  extension <tt class="filename">.props</tt>, and have a very simple syntax,
16  which the following example illustrates:
17</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># Lines starting with '#' are ignored.
18name=value
19another.name=another value
20long.property=Long property value, split over \
21    several lines
22escape.property=Newlines and tabs can be inserted \
23    using the \t and \n escapes
24backslash.property=A backslash can be inserted by writing \\.</pre></td></tr></table></div><p>
25  Now we look at the <tt class="filename">QuickNotepad.props</tt> file
26  which contains properties for the QuickNotepad plugin.
27  The first type of property data is information about the plugin itself;
28  these are the only properties that must be specified in order for the
29  plugin to load:
30</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># general plugin information
31plugin.QuickNotepadPlugin.activate=defer
32plugin.QuickNotepadPlugin.name=QuickNotepad
33plugin.QuickNotepadPlugin.author=John Gellene
34plugin.QuickNotepadPlugin.version=4.1
35plugin.QuickNotepadPlugin.docs=QuickNotepad.html
36plugin.QuickNotepadPlugin.depend.0=jedit 04.02.10.00</pre></td></tr></table></div><p>
37  These properties are described in detail in the documentation for the
38  <a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">
39  <tt class="classname">EditPlugin</tt></a> class
40  and do not require further
41  discussion here.
42</p><p>
43  Next in the file comes a property that sets the title of the
44  plugin's dockable window. Dockable windows are discussed in detail
45  in <a href="plugin-implement-dockables.html" title="The Dockable Window Catalog">the section called &#8220;The Dockable Window Catalog&#8221;</a>.
46</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># dockable window name
47quicknotepad.title=QuickNotepad</pre></td></tr></table></div><p>
48  Next, we see menu item labels for the plugin's actions.
49  Actions are discussed in detail
50  in <a href="plugin-implement-actions.html" title="The Action Catalog">the section called &#8220;The Action Catalog&#8221;</a>.
51</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># action labels
52quicknotepad.label=QuickNotepad
53quicknotepad.choose-file.label=Choose notepad file
54quicknotepad.save-file.label=Save notepad file
55quicknotepad.copy-to-buffer.label=Copy notepad to buffer</pre></td></tr></table></div><p>
56  Next, the plugin's menu is defined. See
57  <a href="plugin-implement-quicknotepadplugin.html" title="The QuickNotepadPlugin Class">the section called &#8220;The QuickNotepadPlugin Class&#8221;</a>.
58</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># application menu items
59quicknotepad.menu.label=QuickNotepad
60quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
61  quicknotepad.save-file quicknotepad.copy-to-buffer</pre></td></tr></table></div><p>
62  We have created a small toolbar as a component of QuickNotepad, so
63  file names for the button icons follow:
64</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># plugin toolbar buttons
65quicknotepad.choose-file.icon=Open.png
66quicknotepad.save-file.icon=Save.png
67quicknotepad.copy-to-buffer.icon=Edit.png</pre></td></tr></table></div><p>
68  The menu item labels corresponding to these icons will also serve as tooltip
69  text.
70</p><p>
71  Finally, the properties file set forth the labels and settings
72  used by the option pane:
73</p><div class="informalexample"><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting"># Option pane labels
74options.quicknotepad.label=QuickNotepad
75options.quicknotepad.file=File:
76options.quicknotepad.choose-file=Choose
77options.quicknotepad.choose-file.title=Choose a notepad file
78options.quicknotepad.choose-font=Font:
79options.quicknotepad.show-filepath.title=Display notepad file path
80
81# Initial default font settings
82options.quicknotepad.show-filepath=true
83options.quicknotepad.font=Monospaced
84options.quicknotepad.fontstyle=0
85options.quicknotepad.fontsize=14
86
87# Setting not defined but supplied for completeness
88options.quicknotepad.filepath=</pre></td></tr></table></div><div class="sidebar"><p class="title"><b>Updating 4.1 plugins</b></p><p>
89 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">
90  <tt class="classname">EditPlugin</tt></a> class for details.
91 </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>