PageRenderTime 47ms CodeModel.GetById 19ms RepoModel.GetById 1ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/42docs/news42/plugin-api.html

#
HTML | 31 lines | 31 code | 0 blank | 0 comment | 0 complexity | 842a23ac09c557a77ac1af3d7a3fd9fe 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>Dynamic Plugin Loading</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="What's New in jEdit 4.2"><link rel="up" href="api-changes.html" title="Chapter 2. API Changes"><link rel="previous" href="beanshell.html" title="BeanShell"><link rel="next" href="class-editplugin.html" title="EditPlugin Class Changes"></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">Dynamic Plugin Loading</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="beanshell.html">Prev</a> </td><th width="60%" align="center">Chapter 2. API Changes</th><td width="20%" align="right"> <a accesskey="n" href="class-editplugin.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-api"></a>Dynamic Plugin Loading</h2></div></div><div></div></div><p>
  2. In jEdit 4.1 and earlier, plugins are always fully loaded at program
  3. startup, and unloaded at program shutdown. While the plugin loader and
  4. API was very simple as a result, this scheme had two main
  5. disadvantages:
  6. </p><div class="itemizedlist"><ul type="disc"><li><p>Having a large number of plugins generally slowed down
  7. jEdit startup, since many plugins performed a lot of lengthy
  8. initialization.
  9. Even if all plugins made their <tt class="function">start()</tt>
  10. methods as quick as possible, there would still be the overhead of
  11. scanning the JAR files, loading the plugin classes, and so on.</p></li><li><p>There was no way to reload plugins in a running jEdit
  12. instance. This made plugin development and use of the plugin manager
  13. a bit cumbersome.</p></li></ul></div><p>
  14. Through a stroke of insight, one notices that the only
  15. functions called from most plugins' <tt class="function">start()</tt>
  16. methods fall into two categories:
  17. </p><div class="itemizedlist"><ul type="disc"><li><p>Registration of virtual file systems, fold handlers,
  18. macro handlers, Console shells, SideKick parsers, ...</p></li><li><p>Arbitriary initialization that only needs to be
  19. done when the plugin is first invoked by the user, and not at
  20. program startup.</p></li></ul></div><p>
  21. jEdit 4.2 moves the former task out of the <tt class="function">start()</tt>
  22. method and into a file within the JAR that can be parsed quickly. This
  23. allows the plugin core class to only be loaded, and its
  24. <tt class="function">start()</tt> method called, only when
  25. the plugin is first invoked. Note that the <tt class="function">start()</tt>
  26. method is always called from the event dispatch thread (or from
  27. the main thread if the GUI has not yet been loaded). Therefore you
  28. do not need to worry about thread-safety issues.
  29. </p><p>
  30. Also, plugins can now be loaded and unloaded at runtime.
  31. </p></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="beanshell.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="api-changes.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="class-editplugin.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">BeanShell </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> EditPlugin Class Changes</td></tr></table></div></body></html>