/jEdit/branches/4.4.x-merge-request-for-r19201/doc/users-guide/plugin-intro.xml

# · XML · 131 lines · 105 code · 20 blank · 6 comment · 0 complexity · 084bee420abb87c64720325562578bbf MD5 · raw file

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <chapter id="plugin-intro">
  3. <title>Introducing the Plugin API</title>
  4. <!-- :indentSize=1:tabSize=2:noTabs=true:wrap=soft:maxLineLen=0: -->
  5. <!-- :xml.root=users-guide.xml: -->
  6. <!-- jEdit 4 Plugin Guide, (C) 2001, 2002 John Gellene -->
  7. <!-- jEdit buffer-local properties: -->
  8. <!-- This is the introduction of the jEdit 4 Plugin Guide -->
  9. <!-- $Id: plugin-intro.xml 17179 2010-02-02 05:56:07Z ezust $ -->
  10. <indexterm>
  11. <primary>Plugin API</primary>
  12. <secondary>introduction</secondary>
  13. </indexterm>
  14. <para>The <firstterm>jEdit Plugin API</firstterm> provides a framework for
  15. hosting plugin applications without imposing any requirements on the design
  16. or function of the plugin itself. You could write an application that
  17. performs spell checking, displays a clock or plays chess and turn it into a
  18. jEdit plugin. There are currently over 50 released plugins for jEdit. While
  19. none of them play chess, they perform a wide variety of editing and file
  20. management tasks.</para>
  21. <para>A detailed listing of available plugins is available at <ulink
  22. url="http://plugins.jedit.org">plugins.jedit.org</ulink>. You can also find
  23. beta versions of new plugins in the <quote>Downloads</quote> area of <ulink
  24. url="http://community.jedit.org">community.jedit.org</ulink>.</para>
  25. <para>Using the <quote>Plugin Manager</quote> feature of jEdit, users with
  26. an Internet connection can check for new or updated plugins and install and
  27. remove them without leaving jEdit. See <xref linkend="using-plugins" /> for
  28. details.</para>
  29. <para>Requirements for <quote>plugging in</quote> to jEdit are as
  30. follows:</para>
  31. <itemizedlist>
  32. <listitem>
  33. <para>This plugin must supply information about itself, such as its
  34. name, version, author, and compatibility with versions of
  35. jEdit.</para>
  36. </listitem>
  37. <listitem>
  38. <para>The plugin must provide for activating, displaying and
  39. deactivating itself upon direction from jEdit, typically in response
  40. to user input<footnote>
  41. <para>You should test your plugin by loading and unloading
  42. it from both the Plugin Manager, as well as the <emphasis
  43. role="bold">Activator Plugin</emphasis>.</para>
  44. </footnote>. Make sure you can continue to use both your plugin
  45. and the editor after it has been reloaded.</para>
  46. </listitem>
  47. <listitem>
  48. <para>Each Plugin has an ActionSet defined by jEdit, which is added
  49. to the main ActionContext. The ActionSet is a container for
  50. EditAction instances. The plugin may define
  51. <firstterm>actions</firstterm> in a number of ways. One way is
  52. explicitly, with an action definition file known as
  53. <literal>actions.xml</literal>. Another is implicitly, by defining
  54. dockable windows in <literal>dockables.xml</literal>.</para>
  55. <para>Most EditActions are small blocks of BeanShell code that jEdit
  56. will perform on behalf of the plugin upon user request. They provide
  57. the <quote>glue</quote> between user input and specific plugin
  58. routines.</para>
  59. <para>By convention, plugins display their available actions in
  60. submenus of jEdit's <guimenu>Plugins</guimenu> menu; each menu item
  61. corresponds to an action. Plugin authors do not define specific
  62. shortcuts - the user can/will assign EditActions to keyboard
  63. shortcuts, toolbar buttons, or entries in the text area's Context
  64. menu (right-click menu).</para>
  65. </listitem>
  66. <listitem>
  67. <para>The plugin may, but need not, provide a user interface.</para>
  68. <para>If the plugin has a visible interface, it can be shown in any
  69. object derived from one of Java top-level container classes:
  70. <classname>JWindow</classname>, <classname>JDialog</classname>, or
  71. <classname>JFrame</classname>. jEdit also provides a dockable window
  72. API, which allows plugin windows derived from the
  73. <classname>JComponent</classname> class to be docked into views or
  74. shown in top-level frames, at the user's request.</para>
  75. <para>Plugins can also act directly upon jEdit's text area. They can
  76. add graphical elements to the text display (like error highlighting
  77. in the case of the <application>ErrorList</application> plugin) or
  78. decorations surrounding the text area (like the
  79. <application>JDiff</application> plugin's summary views). These
  80. plugins are dependent on the JEditTextArea class, which is currently
  81. getting refactored.</para>
  82. </listitem>
  83. <listitem>
  84. <para>Plugins may provide a range of options that the user can
  85. modify to alter their configuration.</para>
  86. <para>If a plugin provides configuration options in accordance with
  87. the plugin API, jEdit will make them available in the
  88. <guilabel>Global Options</guilabel> dialog box.</para>
  89. </listitem>
  90. <listitem>
  91. <para>While it is not required, plugins are encouraged to provide
  92. documentation.</para>
  93. </listitem>
  94. </itemizedlist>
  95. <para>As noted, many of these features are optional; it is possible to write
  96. a plugin that does not provide actions, configuration options, or dockable
  97. windows. The majority of plugins, however, provide most of these
  98. services.</para>
  99. <sidebar>
  100. <title>Plugins and different jEdit versions</title>
  101. <para>As jEdit continues to evolve and improve, elements of the API may
  102. change with a new jEdit release.</para>
  103. <para>On occasion an API change will break code used by plugins,
  104. although efforts are made to maintain or deprecate plugin-related code
  105. on a transitional basis. While the majority of plugins are unaffected by
  106. most changes and will continue working, it is a good idea to monitor the
  107. jEdit change log, and join the <literal>jedit-devel</literal> mailing list, to keep updated on changes and bug reports, so that you will know when your
  108. plugin needs to be updated.
  109. </para>
  110. </sidebar>
  111. </chapter>