PageRenderTime 54ms CodeModel.GetById 45ms app.highlight 6ms RepoModel.GetById 1ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/42docs/news42/class-editplugin.html

#
HTML | 60 lines | 60 code | 0 blank | 0 comment | 0 complexity | 79921d10383d3a3b9a6d0eb6cffdeb25 MD5 | raw file
 1<html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>EditPlugin Class Changes</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="plugin-api.html" title="Dynamic Plugin Loading"><link rel="next" href="actions.html" title="Actions"></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">EditPlugin Class Changes</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="plugin-api.html">Prev</a> </td><th width="60%" align="center">Chapter 2. API Changes</th><td width="20%" align="right"> <a accesskey="n" href="actions.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="class-editplugin"></a>EditPlugin Class Changes</h2></div></div><div></div></div><p>
 2		Documentation for the properties mentioned below, and their possible values,
 3		can be found in the
 4		documentation for the <a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">EditPlugin</a> class.
 5	</p><p>
 6		jEdit distinguishes between jEdit 4.1 and 4.2-style plugins by checking
 7		for the presence of a single property,
 8		<tt class="property">plugin.<i class="replaceable"><tt>class
 9		name</tt></i>.activate</tt>. If this property is present, the
10		plugin is loaded using the new API.
11	</p><p>
12		Since the plugin's menu might need to be displayed before its core class
13		is fully loaded, there is a new way of specifying the plugin menu using
14		properties; the <tt class="function">createMenuItems()</tt> method of the
15		<a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">EditPlugin</a>
16		class has been deprecated.
17	</p><p>
18		For example, the jEdit 4.1 version of the QuickNotepad plugin had the
19		following <tt class="function">createMenuItems()</tt> method:
20	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">public void createMenuItems(Vector menuItems)
21{
22    menuItems.addElement(GUIUtilities.loadMenu("quicknotepad.menu"));
23}</pre></td></tr></table><p>
24		Additionally, the following two properties were defined in
25		<tt class="filename">QuickNotepad.props</tt>:
26	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">quicknotepad.menu.label=QuickNotepad
27quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
28    quicknotepad.save-file quicknotepad.copy-to-buffer</pre></td></tr></table><p>
29		The jEdit 4.2 version of this plugin no longer has a
30		<tt class="function">createMenuItems()</tt> method, and instead defines the
31		following property:
32	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">plugin.QuickNotepadPlugin.menu=quicknotepad \
33    - \
34    quicknotepad.choose-file \
35    quicknotepad.save-file \
36    quicknotepad.copy-to-buffer</pre></td></tr></table><p>
37		Note that specifying a <tt class="property">.label</tt> property for the menu
38		is no longer necessary, as the label becomes the name of the plugin.
39	</p><p>
40		If the content of your plugin's menu is determined at runtime, you must
41		use the new dynamic menu API by defining a property like so:
42	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">plugin.MyPlugin.menu.code=new MyPluginMenuProvider();</pre></td></tr></table><p>
43		The value of the property is a BeanShell snippet that should evaluate to a
44		<a href="../api/org/gjt/sp/jedit/menu/DynamicMenuProvider.html" target="_top">DynamicMenuProvider</a>
45		instance.
46	</p><p>
47		Similarly, option panes should are now specified using properties, and
48		the <tt class="function">createOptionPanes()</tt> method of the
49		<a href="../api/org/gjt/sp/jedit/EditPlugin.html" target="_top">EditPlugin</a>
50		class has been deprecated.
51	</p><p>
52		In QuickNotepad's case, the <tt class="function">createOptionPanes()</tt>
53		method has been removed:
54	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">public void createOptionPanes(OptionsDialog od)
55    {
56        od.addOptionPane(new QuickNotepadOptionPane());
57    }</pre></td></tr></table><p>
58		The new properties look like this:
59	</p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="programlisting">plugin.QuickNotepadPlugin.option-pane=quicknotepad
60options.quicknotepad.code=new QuickNotepadOptionPane();</pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="plugin-api.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="actions.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Dynamic Plugin Loading </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Actions</td></tr></table></div></body></html>