PageRenderTime 28042ms CodeModel.GetById 41ms RepoModel.GetById 1ms app.codeStats 0ms


HTML | 82 lines | 80 code | 2 blank | 0 comment | 0 complexity | 7e713afb60ad4c65d25f2a78296c2c8f 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
  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.73.2"><link rel="start" href="index.html" title="jEdit 4.3 User's Guide"><link rel="up" href="plugin-implement.html" title="Chapter 18. Implementing a Simple Plugin"><link rel="prev" href="plugin-implement-quicknotepadplugin.html" title="The QuickNotepadPlugin Class"><link rel="next" href="plugin-implement-editbus.html" title="The EditBus"></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-quicknotepadplugin.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-editbus.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><p>jEdit maintains a list of &#8220;<span class="quote">properties</span>&#8221;, which are
  2. name/value pairs used to store human-readable strings, user settings,
  3. and various other forms of meta-data. During startup, jEdit loads the
  4. default set of properties, followed by plugin properties stored in
  5. plugin JAR files, finally followed by user properties.</p><p>Some properties are used by the plugin API itself. Others are
  6. accessed by the plugin using methods in the <a class="ulink" href="../api/org/gjt/sp/jedit/jEdit.html" target="_top">
  7. <code class="classname">jEdit</code></a> class. Others are accessed by the
  8. scripts used by plugin packagers <sup>[<a name="id2608375" href="#ftn.id2608375" class="footnote">2</a>]</sup>.</p><p>Property files contained in plugin JARs must end with the filename
  9. extension <code class="filename">.props</code>, and have a very simple syntax,
  10. which the following example illustrates:</p><div class="informalexample"><pre class="programlisting"># Lines starting with '#' are ignored.
  11. name=value
  12. value
  13. property value, split over \
  14. several lines
  15. and tabs can be inserted \
  16. using the \t and \n escapes
  17. backslash can be inserted by writing \\.</pre></div><p>Now we look at a fragment from the
  18. <code class="filename">QuickNotepad.props</code> file <sup>[<a name="id2608424" href="#ftn.id2608424" class="footnote">3</a>]</sup> which contains properties for the QuickNotepad plugin.
  19. The first type of property data is information about the plugin itself;
  20. these are the only properties that must be specified in order for the
  21. plugin to load:</p><div class="informalexample"><pre class="programlisting"># general plugin information
  22. plugin.QuickNotepadPlugin.activate=defer
  24. Gellene
  25. plugin.QuickNotepadPlugin.version=4.03
  27. # depends on jedit 4.2final
  28. plugin.QuickNotepadPlugin.depend.0=jedit
  29. plugin.QuickNotepadPlugin.description=A demo jEdit plugin that provides a notepad dockable.
  30. plugin.QuickNotepadPlugin.longdescription=description.html
  31. </pre></div><p>These properties are each described in detail in the documentation
  32. for the <a class="ulink" href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">
  33. <code class="classname">EditPlugin</code></a> class and do not require
  34. further discussion here.</p><p>Next in the file comes a property that sets the title of the
  35. plugin's dockable window. Dockable windows are discussed in detail in
  36. <a class="xref" href="plugin-implement-dockables.html" title="The dockables.xml Window Catalog">the section called &#8220;The dockables.xml Window Catalog&#8221;</a>.</p><div class="informalexample"><pre class="programlisting"># dockable window name
  37. quicknotepad.title=QuickNotepad</pre></div><p>Next, we see menu item labels for the plugin's actions. All of
  38. these but the first are defined in <code class="literal">actions.xml</code> file,
  39. and that is because the dockable itself has its own actions. Actions are
  40. discussed further in <a class="xref" href="plugin-implement-actions.html" title="The Actions Catalog">the section called &#8220;The Actions Catalog&#8221;</a>.</p><div class="informalexample"><pre class="programlisting"># action labels
  41. # Dockable label
  42. quicknotepad.label=QuickNotepad
  43. # Additional strings extracted from the plugin java source
  44. quicknotepad.choose-file.label=Choose notepad file
  45. notepad file
  46. quicknotepad.copy-to-buffer.label=Copy notepad to buffer
  47. </pre></div><p>Next, the plugin's menu is defined. See <a class="xref" href="plugin-implement-quicknotepadplugin.html" title="The QuickNotepadPlugin Class">the section called &#8220;The QuickNotepadPlugin Class&#8221;</a>.</p><div class="informalexample"><pre class="programlisting"># application menu items
  49. - quicknotepad.choose-file \
  50. quicknotepad.copy-to-buffer</pre></div><p>We have created a small toolbar as a component of QuickNotepad, so
  51. file names for the button icons follow:</p><div class="informalexample"><pre class="programlisting"># plugin toolbar buttons
  52. quicknotepad.choose-file.icon=Open.png
  54. quicknotepad.copy-to-buffer.icon=Edit.png</pre></div><p>The menu item labels corresponding to these icons will also serve
  55. as tooltip text.</p><p>Finally, the properties file set forth the labels and settings
  56. used by the option pane:</p><div class="informalexample"><pre class="programlisting"># Option pane labels
  57. options.quicknotepad.label=QuickNotepad
  58. options.quicknotepad.file=File:
  59. options.quicknotepad.choose-file=Choose
  60. options.quicknotepad.choose-file.title=Choose a notepad file
  61. options.quicknotepad.choose-font=Font:
  62. notepad file path
  63. # Initial default font settings
  65. options.quicknotepad.font=Monospaced
  66. options.quicknotepad.fontstyle=0
  67. options.quicknotepad.fontsize=14
  68. # Setting not defined but supplied for completeness
  69. options.quicknotepad.filepath=</pre></div><div class="tip" style="margin-left: 0.5in; margin-right: 0.5in;"><h3 class="title">PropertySideKick</h3><p>There is a SideKick for Property files, provided in the
  70. JavaSideKick plugin. This gives you a compact and sorted tree view
  71. of property files.</p></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
  72. the presence of the
  73. <code class="literal">plugin.<em class="replaceable"><code>name</code></em>.activate</code>
  74. property. If this property is set, the plugin is treated like a
  75. jEdit 4.2 plugin. Usually, this property should be set to
  76. <code class="literal">defer</code>. See the API documentation for the <a class="ulink" href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">
  77. <code class="classname">EditPlugin</code></a> class for details. jEdit
  78. 4.1 plugins which have not been updated to use the 4.2 API will not
  79. be supported in jEdit 4.3.</p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2608375" href="#id2608375" class="para">2</a>] </sup>See the <span class="guimenuitem"><strong>Macros/Properties/Create Plugin
  80. Announcement</strong></span> macro for an example.</p></div><div class="footnote"><p><sup>[<a name="ftn.id2608424" href="#id2608424" class="para">3</a>] </sup>Examine the actual file for a more complete example</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="plugin-implement-quicknotepadplugin.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-editbus.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The QuickNotepadPlugin Class </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The EditBus</td></tr></table></div></body></html>