PageRenderTime 41ms CodeModel.GetById 17ms RepoModel.GetById 0ms 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
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.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.
  18. name=value
  19. another.name=another value
  20. long.property=Long property value, split over \
  21. several lines
  22. escape.property=Newlines and tabs can be inserted \
  23. using the \t and \n escapes
  24. backslash.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
  31. plugin.QuickNotepadPlugin.activate=defer
  32. plugin.QuickNotepadPlugin.name=QuickNotepad
  33. plugin.QuickNotepadPlugin.author=John Gellene
  34. plugin.QuickNotepadPlugin.version=4.1
  35. plugin.QuickNotepadPlugin.docs=QuickNotepad.html
  36. plugin.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
  47. quicknotepad.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
  52. quicknotepad.label=QuickNotepad
  53. quicknotepad.choose-file.label=Choose notepad file
  54. quicknotepad.save-file.label=Save notepad file
  55. quicknotepad.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
  59. quicknotepad.menu.label=QuickNotepad
  60. quicknotepad.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
  65. quicknotepad.choose-file.icon=Open.png
  66. quicknotepad.save-file.icon=Save.png
  67. quicknotepad.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
  74. options.quicknotepad.label=QuickNotepad
  75. options.quicknotepad.file=File:
  76. options.quicknotepad.choose-file=Choose
  77. options.quicknotepad.choose-file.title=Choose a notepad file
  78. options.quicknotepad.choose-font=Font:
  79. options.quicknotepad.show-filepath.title=Display notepad file path
  80. # Initial default font settings
  81. options.quicknotepad.show-filepath=true
  82. options.quicknotepad.font=Monospaced
  83. options.quicknotepad.fontstyle=0
  84. options.quicknotepad.fontsize=14
  85. # Setting not defined but supplied for completeness
  86. options.quicknotepad.filepath=</pre></td></tr></table></div><div class="sidebar"><p class="title"><b>Updating 4.1 plugins</b></p><p>
  87. 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">
  88. <tt class="classname">EditPlugin</tt></a> class for details.
  89. </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>