/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
- <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>
- In jEdit 4.1 and earlier, plugins are always fully loaded at program
- startup, and unloaded at program shutdown. While the plugin loader and
- API was very simple as a result, this scheme had two main
- disadvantages:
- </p><div class="itemizedlist"><ul type="disc"><li><p>Having a large number of plugins generally slowed down
- jEdit startup, since many plugins performed a lot of lengthy
- initialization.
- Even if all plugins made their <tt class="function">start()</tt>
- methods as quick as possible, there would still be the overhead of
- 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
- instance. This made plugin development and use of the plugin manager
- a bit cumbersome.</p></li></ul></div><p>
- Through a stroke of insight, one notices that the only
- functions called from most plugins' <tt class="function">start()</tt>
- methods fall into two categories:
- </p><div class="itemizedlist"><ul type="disc"><li><p>Registration of virtual file systems, fold handlers,
- macro handlers, Console shells, SideKick parsers, ...</p></li><li><p>Arbitriary initialization that only needs to be
- done when the plugin is first invoked by the user, and not at
- program startup.</p></li></ul></div><p>
- jEdit 4.2 moves the former task out of the <tt class="function">start()</tt>
- method and into a file within the JAR that can be parsed quickly. This
- allows the plugin core class to only be loaded, and its
- <tt class="function">start()</tt> method called, only when
- the plugin is first invoked. Note that the <tt class="function">start()</tt>
- method is always called from the event dispatch thread (or from
- the main thread if the GUI has not yet been loaded). Therefore you
- do not need to worry about thread-safety issues.
- </p><p>
- Also, plugins can now be loaded and unloaded at runtime.
- </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>