PageRenderTime 70ms CodeModel.GetById 19ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/doc/users-guide/plugin-intro.xml

#
XML | 146 lines | 120 code | 20 blank | 6 comment | 0 complexity | f621f71e9773a85e3e631fdd4fe20b5e 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. <!-- jEdit 4.0 Plugin Guide, (C) 2001 John Gellene -->
  2. <!-- jEdit buffer-local properties: -->
  3. <!-- :indentSize=1:tabSize=2:noTabs=true:maxLineLen=72: -->
  4. <!-- This is the introduction of the jEdit 4.0 Plugin Guide -->
  5. <!-- $Id: plugin-intro.xml 3897 2001-11-13 15:11:42Z jgellene $
  6. -->
  7. <chapter id="plugin-intro"> <title>
  8. <indexterm>
  9. <primary>Plugin API</primary>
  10. <secondary>introduction</secondary>
  11. </indexterm>
  12. Introducing the Plugin API</title>
  13. <para>
  14. The <firstterm>jEdit Plugin API</firstterm> provides a framework for
  15. hosting plugin applications without imposing any
  16. requirements on the design or function of the plugin itself. You could
  17. write a application that performs spell checking, displays a clock or
  18. plays chess and turn it into a jEdit plugin. There are currently over 40
  19. released plugins for jEdit. While none of them play chess,
  20. they perform a wide variety of editing and file management tasks. A
  21. detailed listing of available plugins is available at the jEdit
  22. <ulink url="http://plugins.jedit.org">Plugin Central</ulink> web site.
  23. </para>
  24. <para>
  25. Using the plugin manager feature of jEdit, users with an
  26. Internet connnection can check for new or updated plugins and install
  27. and remove them without leaving jEdit. See <xref
  28. linkend="using-plugins" /> for details.
  29. </para>
  30. <para>
  31. In order to <quote>plug in</quote> to jEdit, a plugin must implement
  32. interfaces or data that deal with the following matters:
  33. </para>
  34. <itemizedlist>
  35. <listitem><para>
  36. Ths plugin must supply information about itself, such as its name,
  37. version, author, and compatibility with versions of jEdit.
  38. </para></listitem>
  39. <listitem><para>
  40. The plugin must provide for activating, displaying and
  41. deactivating itself upon direction from jEdit,
  42. typically in response to user input.
  43. </para></listitem>
  44. <listitem><para>
  45. The plugin may, but need not, provide a user interface.
  46. </para>
  47. <para>
  48. If the plugin has a visible interface, it can be shown in any object
  49. derived from one of Java top-level container classes:
  50. <classname>JWindow</classname>, <classname>JDialog</classname>, or
  51. <classname>JFrame</classname>. jEdit also provides a dockable window
  52. API, which allows plugin windows derived from the
  53. <classname>JComponent</classname>to be docked into views or shown in
  54. top-level frames, at the user's request.
  55. </para>
  56. <para>
  57. Plugins can also act directly upon jEdit's text area. They
  58. can add graphical elements to the text display (like error
  59. highlighting in the case of the <application>ErrorList</application>
  60. plugin) or decorations
  61. surrounding the text area (like the <application>JDiff</application>
  62. plugin's summary views).
  63. </para>
  64. </listitem>
  65. <listitem><para>
  66. Plugins may (and typically do) define <firstterm>actions</firstterm>
  67. that jEdit will perform on behalf of the plugin upon
  68. user request. Actions are small blocks of BeanShell code that
  69. provide the <quote>glue</quote> between user input and
  70. specifc plugin routines.
  71. </para>
  72. <para>
  73. By convention, plugins display their available actions in submenus of
  74. jEdit's <guimenu>Plugins</guimenu> menu; each menu item corresponds to
  75. an action. The user can also assign actions to keyboard shortcuts,
  76. toolbar buttons or entries in the text area's right-click menu.
  77. </para>
  78. </listitem>
  79. <listitem><para>
  80. Plugins may provide a range of options that the user can modify to
  81. alter its configuration.
  82. </para>
  83. <para>
  84. If a plugin provides configuration options in accordance with the plugin
  85. API, jEdit will make them available in the <guilabel>Global
  86. Options</guilabel> dialog. Each plugin with options is listed in the
  87. tree view in that dialog under <guilabel>Plugin Options</guilabel>.
  88. Clicking on the tree node for a plugin causes the corresponding set
  89. of options to be displayed.
  90. </para>
  91. </listitem>
  92. </itemizedlist>
  93. <para>
  94. As noted, many of these features are optional; it is possible to write
  95. a plugin that does not provide actions, configuration options, or dockable
  96. windows. The majority of plugins, however, provide most of these services.
  97. </para>
  98. <para>
  99. In the following chapters, we will begin by briefly describing jEdit's
  100. host capabilities, which includes the loading and display of plugins.
  101. Next we will describe the principal classes and data structures that a
  102. plugin must implement. Finally, we will outline the building of a modest
  103. plugin, <quote>QuickNotepad</quote>, that illustrates the requirements and
  104. some of the techniques of jEdit plugin design.
  105. </para>
  106. <sidebar><title>Plugins and different jEdit versions</title>
  107. <para>
  108. As jEdit continues to evolve and improve, elements of the plugin API or
  109. jEdit's general API may change with a new jEdit release. For example,
  110. version 4.0 of jEdit has simplified the design of a plugin by
  111. placing code for the activation of a plugin's docking window in an
  112. XML file rather than in a Java class. The use of a Java interface for
  113. docking windows has been deprecated. We will explain this and other changes
  114. in the plugin API for jEdit 4.0 when discussing the model QuickNotepad plugin.
  115. </para>
  116. <para>
  117. On occasion an API change will break code used by plugins, although
  118. efforts are made to maintain or deprecate plugin-related code on a
  119. trasisional basis. possible. While the majority of plugins are
  120. unaffected by most changes and will continue working, it is a good idea
  121. to monitor the jEdit changelog, the mailing lists or <ulink
  122. url="http://community.jedit.org">jEdit Community</ulink> for API changes
  123. and update your plugin as necessary.
  124. </para>
  125. </sidebar>
  126. </chapter>