PageRenderTime 45ms CodeModel.GetById 21ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/users-guide/plugin-implement-services.html

#
HTML | 25 lines | 24 code | 1 blank | 0 comment | 0 complexity | 55d23c94bc331545540698b3b5e3a54a 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 services.xml 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-dockables.html" title="The dockables.xml Window Catalog"><link rel="next" href="plugin-implement-quicknotepad.html" title="The QuickNotepad Class"></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 services.xml file</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="plugin-implement-dockables.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-quicknotepad.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-services"></a>The services.xml file</h2></div></div></div><p>A "service" is a mechanism by which one plugin can work with other
  2. plugins and avoid a bidirectional build-dependency. For example, the XML
  3. plugin "depends" on Sidekick, but in fact, it is SideKick which creates
  4. and operates on an object (a <code class="literal">SideKickParser</code>, in fact)
  5. defined in the XML plugin. In a way, the dependency is
  6. bidirectional.</p><p>Similarly, the AntFarm plugin defines but does not instantiate a
  7. <code class="literal">Shell</code> object. It is the Console plugin which creates
  8. a specific shell for each available service. SideKick and Console use
  9. the ServiceManager to search for services offered by other
  10. plugins.</p><p>Here is an example of a service from the XML plugin, which extends
  11. Sidekick:</p><div class="informalexample"><pre class="programlisting">
  12. &lt;!DOCTYPE SERVICES SYSTEM "services.dtd"&gt;
  13. &lt;SERVICES&gt;
  14. &lt;SERVICE CLASS="sidekick.SideKickParser" NAME="xml"&gt;
  15. new xml.parser.SAXParserImpl();
  16. &lt;/SERVICE&gt;
  17. &lt;/SERVICES&gt;
  18. </pre></div><p>The object it returns tells Sidekick how it can parse files of a
  19. specific type. The API docs for SideKickParser indicate exactly which
  20. methods must be implemented in a plugin which offers this service. It
  21. should be enough information to let Sidekick, which has its own
  22. dockable, display the tree information in its own view.</p><p>For more information about services, refer to the <a class="ulink" href="../api/org/gjt/sp/jedit/ServiceManager.html" target="_top">ServiceManager</a>
  23. class API documentation. There, you can find out what the tags and
  24. attributes mean, as well as how to register and use services.</p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="plugin-implement-dockables.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-quicknotepad.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">The dockables.xml Window Catalog </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> The QuickNotepad Class</td></tr></table></div></body></html>