PageRenderTime 41ms CodeModel.GetById 13ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/users-guide/plugin-intro.html

#
HTML | 58 lines | 58 code | 0 blank | 0 comment | 0 complexity | c20450e5b6a293241694664fd7e2b39c 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>Chapter 17. Introducing the Plugin API</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="writing-plugins-part.html" title="Part IV. Writing Plugins"><link rel="prev" href="writing-plugins-part.html" title="Part IV. Writing Plugins"><link rel="next" href="plugin-implement.html" title="Chapter 18. Implementing a Simple Plugin"></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">Chapter 17. Introducing the Plugin API</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="writing-plugins-part.html">Prev</a> </td><th width="60%" align="center">Part IV. Writing Plugins</th><td width="20%" align="right"> <a accesskey="n" href="plugin-implement.html">Next</a></td></tr></table><hr></div><div class="chapter" lang="en"><div class="titlepage"><div><div><h2 class="title"><a name="plugin-intro"></a>Chapter 17. Introducing the Plugin API</h2></div></div></div><a class="indexterm" name="id2606459"></a><p>The <em class="firstterm">jEdit Plugin API</em> provides a framework for
  2. hosting plugin applications without imposing any requirements on the design
  3. or function of the plugin itself. You could write an application that
  4. performs spell checking, displays a clock or plays chess and turn it into a
  5. jEdit plugin. There are currently over 50 released plugins for jEdit. While
  6. none of them play chess, they perform a wide variety of editing and file
  7. management tasks.</p><p>A detailed listing of available plugins is available at <a class="ulink" href="http://plugins.jedit.org" target="_top">plugins.jedit.org</a>. You can also find
  8. beta versions of new plugins in the &#8220;<span class="quote">Downloads</span>&#8221; area of <a class="ulink" href="http://community.jedit.org" target="_top">community.jedit.org</a>.</p><p>Using the &#8220;<span class="quote">Plugin Manager</span>&#8221; feature of jEdit, users with
  9. an Internet connection can check for new or updated plugins and install and
  10. remove them without leaving jEdit. See <a class="xref" href="using-plugins.html" title="Chapter 9. Installing and Using Plugins">Chapter 9, <i>Installing and Using Plugins</i></a> for
  11. details.</p><p>Requirements for &#8220;<span class="quote">plugging in</span>&#8221; to jEdit are as
  12. follows:</p><div class="itemizedlist"><ul type="disc"><li><p>This plugin must supply information about itself, such as its
  13. name, version, author, and compatibility with versions of
  14. jEdit.</p></li><li><p>The plugin must provide for activating, displaying and
  15. deactivating itself upon direction from jEdit, typically in response
  16. to user input<sup>[<a name="id2607152" href="#ftn.id2607152" class="footnote">1</a>]</sup>. Make sure you can continue to use both your plugin
  17. and the editor after it has been reloaded.</p></li><li><p>Each Plugin has an ActionSet defined by jEdit, which is added
  18. to the main ActionContext. The ActionSet is a container for
  19. EditAction instances. The plugin may define
  20. <em class="firstterm">actions</em> in a number of ways. One way is
  21. explicitly, with an action definition file known as
  22. <code class="literal">actions.xml</code>. Another is implicitly, by defining
  23. dockable windows in <code class="literal">dockables.xml</code>.</p><p>Most EditActions are small blocks of BeanShell code that jEdit
  24. will perform on behalf of the plugin upon user request. They provide
  25. the &#8220;<span class="quote">glue</span>&#8221; between user input and specific plugin
  26. routines.</p><p>By convention, plugins display their available actions in
  27. submenus of jEdit's <span class="guimenu"><strong>Plugins</strong></span> menu; each menu item
  28. corresponds to an action. Plugin authors do not define specific
  29. shortcuts - the user can/will assign EditActions to keyboard
  30. shortcuts, toolbar buttons, or entries in the text area's Context
  31. menu (right-click menu).</p></li><li><p>The plugin may, but need not, provide a user interface.</p><p>If the plugin has a visible interface, it can be shown in any
  32. object derived from one of Java top-level container classes:
  33. <code class="classname">JWindow</code>, <code class="classname">JDialog</code>, or
  34. <code class="classname">JFrame</code>. jEdit also provides a dockable window
  35. API, which allows plugin windows derived from the
  36. <code class="classname">JComponent</code> class to be docked into views or
  37. shown in top-level frames, at the user's request.</p><p>Plugins can also act directly upon jEdit's text area. They can
  38. add graphical elements to the text display (like error highlighting
  39. in the case of the <span class="application">ErrorList</span> plugin) or
  40. decorations surrounding the text area (like the
  41. <span class="application">JDiff</span> plugin's summary views). These
  42. plugins are dependent on the JEditTextArea class, which is currently
  43. getting refactored.</p></li><li><p>Plugins may provide a range of options that the user can
  44. modify to alter their configuration.</p><p>If a plugin provides configuration options in accordance with
  45. the plugin API, jEdit will make them available in the
  46. <span class="guilabel"><strong>Global Options</strong></span> dialog box.</p></li><li><p>While it is not required, plugins are encouraged to provide
  47. documentation.</p></li></ul></div><p>As noted, many of these features are optional; it is possible to write
  48. a plugin that does not provide actions, configuration options, or dockable
  49. windows. The majority of plugins, however, provide most of these
  50. services.</p><div class="sidebar"><p class="title"><b>Plugins and different jEdit versions</b></p><p>As jEdit continues to evolve and improve, elements of the API may
  51. change with a new jEdit release.</p><p>On occasion an API change will break code used by plugins,
  52. although efforts are made to maintain or deprecate plugin-related code
  53. on a transitional basis. While the majority of plugins are unaffected by
  54. most changes and will continue working, it is a good idea to monitor the
  55. jEdit change log, and join the <code class="literal">jedit-devel</code> mailing list, to keep updated on changes and bug reports, so that you will know when your
  56. plugin needs to be updated.
  57. </p></div><div class="footnotes"><br><hr width="100" align="left"><div class="footnote"><p><sup>[<a name="ftn.id2607152" href="#id2607152" class="para">1</a>] </sup>You should test your plugin by loading and unloading
  58. it from both the Plugin Manager, as well as the <span class="bold"><strong>Activator Plugin</strong></span>.</p></div></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="writing-plugins-part.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="writing-plugins-part.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="plugin-implement.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Part IV. Writing Plugins </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Chapter 18. Implementing a Simple Plugin</td></tr></table></div></body></html>