PageRenderTime 54ms CodeModel.GetById 16ms RepoModel.GetById 1ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/42docs/news42/news.xml

#
XML | 839 lines | 674 code | 163 blank | 2 comment | 0 complexity | 8d06e8109bd70c63080d978321e83799 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. <?xml version="1.0" encoding="UTF-8" ?>
  2. <!-- :folding=sidekick: -->
  3. <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
  4. "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
  5. <book>
  6. <bookinfo>
  7. <author>
  8. <firstname>Slava</firstname><surname>Pestov</surname>
  9. </author>
  10. <copyright><year>2003</year>
  11. <year>2004</year><holder>Slava Pestov</holder></copyright>
  12. <legalnotice><title>Legal Notice</title>
  13. <para>
  14. Permission is granted to copy, distribute and/or modify this document
  15. under the terms of the GNU Free Documentation License, Version 1.1 or
  16. any later version published by the Free Software Foundation; with no
  17. <quote>Invariant Sections</quote>, <quote>Front-Cover Texts</quote> or
  18. <quote>Back-Cover Texts</quote>, each as defined in the license. A copy of
  19. the license is included in the file <filename>COPYING.DOC.txt</filename>
  20. included with the jEdit distribution.
  21. </para>
  22. </legalnotice>
  23. <title>What's New in jEdit 4.2</title>
  24. </bookinfo>
  25. <chapter id="user-changes"><title>User-Visible Changes</title>
  26. <sect1 id="incompatible"><title>Removed Features</title>
  27. <para>
  28. Soft wrapping to the text area width (by setting the wrap width to zero) is no longer supported.
  29. </para>
  30. <para>
  31. The <guimenu>View</guimenu>&gt;<guisubmenu>Scrolling</guisubmenu>&gt;<guimenuitem>Synchronized Scrolling</guimenuitem> command has been removed.
  32. </para>
  33. <para>
  34. The <application>jEditLauncher</application> component for Windows shell integration is no longer included.
  35. </para>
  36. </sect1>
  37. <sect1 id="plugin-manager"><title>Plugin Manager</title>
  38. <para>
  39. A new plugin API has been added that allows plugins to be loaded and unloaded while jEdit is running. The plugin manager's user interface has also been overhauled to be more intuitive and powerful.
  40. </para>
  41. <para>
  42. While the new API is mostly backwards compatible, some plugins will no longer work. The best way to upgrade from 4.1 to 4.2 is to completely remove any existing plugins, and re-install a new set from scratch.
  43. </para>
  44. <para>
  45. Plugin options have been moved from the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box to a new <guimenu>Plugins</guimenu>&gt;<guimenuitem>Plugin Options</guimenuitem> dialog box.
  46. </para>
  47. <para>
  48. If you are a plugin developer, see <xref linkend="api-changes"/>.
  49. </para>
  50. </sect1>
  51. <sect1 id="interface"><title>User Interface</title>
  52. <para>
  53. jEdit now saves the configuration of open views between sessions; this includes including their position, size and any splits. This information is stored in the <filename>perspective.xml</filename> file in the settings directory.
  54. </para>
  55. <para>
  56. Dockable windows can now be moved between panes without having to open the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box. Just right-click on the dockable window's button, or for floating windows, click the small triangle in the top left corner of the window. In both cases this displays a menu where you can pick a new docking location for the window.
  57. </para>
  58. <para>
  59. A new <guimenu>Utilities</guimenu>&gt;<guimenuitem>Repeat Last Action</guimenuitem> command (shortcut: <keycombo><keycap>Control</keycap><keycap>Space</keycap></keycombo>) repeats the most recently invoked command.
  60. </para>
  61. <para>
  62. The status bar can now optionally display a simple clock. This can be enabled in the <guilabel>Status Bar</guilabel> pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box
  63. </para>
  64. </sect1>
  65. <sect1 id="editing"><title>Text Editing</title>
  66. <para>
  67. Drag and drop of text is now supported in the text area; it can be disabled in the <guimenuitem>Mouse</guimenuitem> pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box.
  68. </para>
  69. <para>
  70. The <guimenu>Edit</guimenu>&gt;<guimenuitem>Complete Word</guimenuitem> command (shortcut: <keycombo><keycap>Control</keycap><keycap>B</keycap></keycombo>) now looks in all visible buffers for completions. Also, the longest common prefix of the completions is inserted if there are multiple completions.
  71. </para>
  72. <para>
  73. The new <guimenu>Edit</guimenu>&gt;<guimenuitem>More Clipboard</guimenuitem>&gt;<guimenuitem>Paste Deleted</guimenuitem> command (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  74. <keycombo><keycap>Control</keycap><keycap>Y</keycap></keycombo>) lists the 20 most recently deleted strings of text. This list of deleted strings is also persistent.
  75. </para>
  76. <para>
  77. Register contents are now saved between editing sessions.
  78. </para>
  79. <para>
  80. The limit of 8 text areas editing a single buffer has been removed.
  81. </para>
  82. <para>
  83. Fold start lines are now colored according to their nesting level in the text area. The colors can be customized in the <guilabel>Syntax Highlighting</guilabel> pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box. <keycap>Alt</keycap>-clicking on a fold in the gutter (or clicking with the middle mouse button) now narrows to that fold.
  84. </para>
  85. <para>
  86. When soft wrap is on, the text area now scrolls by screen lines, instead of scrolling by physical lines.
  87. </para>
  88. </sect1>
  89. <sect1 id="rect"><title>Rectangular Editing</title>
  90. <para>
  91. <guimenu>Edit</guimenu>&gt;<guimenuitem>More Clipboard</guimenuitem>&gt;<guimenuitem>Vertical Paste</guimenuitem> command (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo>
  92. <keycombo><keycap>Control</keycap><keycap>P</keycap></keycombo>) behaves in a more intelligent manner. Entering characters while a rectangular selection is active inserts into each row of the selection, thus a zero-width rectangular selection can now act like a <quote>tall caret</quote>.
  93. </para>
  94. <para>
  95. The new <guimenu>Edit</guimenu>&gt;<guimenuitem>More Selection</guimenuitem>&gt;<guimenuitem>Rectangular Selection</guimenuitem> command (shortcut: <keycombo><keycap>Alt</keycap><keycap>\</keycap></keycombo>) permits rectangular selections to be created using the keyboard. A static bar indicator is shown when rectangular selection mode is active.
  96. </para>
  97. <para>
  98. Clicking beyond the end of a line in rectangular selection mode (or <keycap>Control</keycap>-clicking otherwise) inserts the appropriate amount of whitespace and moves the caret to the clicked location.
  99. </para>
  100. <para>
  101. The rectangular selection now acts like a <quote>tall caret</quote>. Inserting text or pressing <keycap>Backspace</keycap> or <keycap>Delete</keycap> while a rectangular selection is active performs that operation on each selected line.
  102. </para>
  103. </sect1>
  104. <sect1 id="syntax"><title>Syntax Highlighting</title>
  105. <para>
  106. <!-- as of pre15, -->
  107. 34 new syntax highlighting modes were added, and many existing ones were enhanced. jEdit now supports syntax highlighting for 122 languages.
  108. </para>
  109. <para>
  110. The following new token types were added:
  111. </para>
  112. <itemizedlist>
  113. <listitem><para>COMMENT3</para></listitem>
  114. <listitem><para>COMMENT4</para></listitem>
  115. <listitem><para>LITERAL3</para></listitem>
  116. <listitem><para>LITERAL4</para></listitem>
  117. <listitem><para>KEYWORD4</para></listitem>
  118. </itemizedlist>
  119. <para>
  120. Any capture groups defined in the <literal>SPAN_REGEXP</literal>
  121. element's <literal>BEGIN</literal> child are now substituted into the <literal>END</literal> child for matching purposes. This allows here-docs in languages such as Perl to be highlighted correctly.
  122. </para>
  123. <para>
  124. A new <literal>NO_ESCAPE</literal> attribute has been added to the <literal>SPAN</literal> and <literal>SPAN_REGEXP</literal> elements.
  125. </para>
  126. <para>
  127. A new <literal>IMPORT</literal> rule causes the current ruleset to inherit the rules from the given ruleset.
  128. </para>
  129. <para>
  130. A background color defined for a ruleset's default token type now takes effect on tokens that appear inside this ruleset for which no explicit background color is defined.
  131. </para>
  132. </sect1>
  133. <sect1 id="search"><title>Search and Replace</title>
  134. <para>
  135. Added <guimenuitem>Ignore Case</guimenuitem> (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo> <keycombo><keycap>Control</keycap><keycap>I</keycap></keycombo>) and <guimenuitem>Regular Expressions</guimenuitem> (shortcut: <keycombo><keycap>Control</keycap><keycap>E</keycap></keycombo> <keycombo><keycap>Control</keycap><keycap>X</keycap></keycombo>) commands for toggling search bar settings from the keyboard.
  136. </para>
  137. <para>
  138. The <guimenuitem>Incremental Search Bar</guimenuitem> and <guimenuitem>HyperSearch Bar</guimenuitem> commands in the <guimenu>Search</guimenu> menu no longer insert the currently selected text into the search bar. If you prefer this behavior, use <guimenuitem>Incremental Search for Word</guimenuitem> and <guimenuitem>HyperSearch for Word</guimenuitem> instead.
  139. </para>
  140. <para>
  141. Clicking on a line in the <guimenuitem>HyperSearch Results</guimenuitem> window now selects all ocurrences of the search string in that line, not just the first occurrence.
  142. </para>
  143. </sect1>
  144. <sect1 id="files"><title>File Management</title>
  145. <para>
  146. The handling of files that are changed on disk by another program is now more flexible. There are three possible behaviors that can be specified in the <guibutton>General</guibutton> pane of the <guimenu>Utilities</guimenu>&gt;<guimenuitem>Global Options</guimenuitem> dialog box:
  147. </para>
  148. <itemizedlist>
  149. <listitem><para><guilabel>Do nothing</guilabel> - jEdit will not check if files are modified on disk by another program.</para></listitem>
  150. <listitem><para><guilabel>Prompt</guilabel> - a dialog box will be shown listing all changed files, offering to reload them.</para></listitem>
  151. <listitem><para><guilabel>Automatically reload</guilabel> - a dialog box will be shown listing all changed files, and they are all automatically reloaded.</para></listitem>
  152. </itemizedlist>
  153. <para>
  154. When opening a symbolic link on Unix, the opened buffer has the path name of the link itself, not the file pointed by the link. However, it is still not possible to open the same buffer twice by opening two links to the same file.
  155. </para>
  156. </sect1>
  157. <sect1 id="encodings"><title>Handling of Multiple Encodings</title>
  158. <para>
  159. A full list of encodings supported by your Java implementation is now shown in the file system browser's <guimenu>Commands</guimenu>&gt;<guimenuitem>Encoding</guimenuitem> menu and other places. Previously only a small list of common encodings was shown.
  160. </para>
  161. <para>
  162. Files saved in the <literal>UTF-8Y</literal> encoding are now supported. This encoding is identical to <literal>UTF-8</literal> except there
  163. is a three-byte signature (<literal>0xEFBBBF</literal>) at the beginning of the file.
  164. </para>
  165. <para>
  166. UTF8-Y-encoded files are auto-detected as being such.
  167. </para>
  168. <para>
  169. The encoding used by XML files is also auto-detected if the file provides an XML declaration like the following:
  170. </para>
  171. <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]></programlisting>
  172. </sect1>
  173. <sect1 id="vfs.browser"><title>File System Browser</title>
  174. <para>
  175. The file system browser now shows file details such as size, type, modification time and access permissions. Virtual file systems provided by plugins can add their own columns to the view.
  176. </para>
  177. <para>
  178. The favorites list can now contain files, and a new <guimenu>Utilities</guimenu>&gt;<guisubmenu>Favorites</guisubmenu> menu allows accessing favorites without having to open the file system browser first.
  179. </para>
  180. <para>
  181. File name completion in file dialog boxes has been greatly improved. It is now possible to navigate around the file system quite comfortably without using the mouse.
  182. </para>
  183. </sect1>
  184. <sect1 id="bundled-macros"><title>Bundled Macros</title>
  185. <para>
  186. There are a number of new bundled macros, and most of the existing ones have undergone enhancements and bug fixes. jEdit 4.1 bundled 28 macros in 4 categories; jEdit 4.2 bundles 58 macros in 7 categories.
  187. </para>
  188. <para>
  189. Of course you can create new macros of your own, either by recording actions or writing them from scratch.
  190. </para>
  191. </sect1>
  192. </chapter>
  193. <chapter id="api-changes"><title>API Changes</title>
  194. <sect1 id="beanshell"><title>BeanShell</title>
  195. <para>
  196. BeanShell has been updated from version 1.2b7 to 2.0b1. The
  197. new release of BeanShell brings support for scripted
  198. classes, static imports, mixins, better
  199. error reporting, improved performance, and various fixes.
  200. </para>
  201. <para>
  202. A number of jEdit-specific changes are also present in this
  203. BeanShell version; they will eventually be merged back into
  204. the main BeanShell source tree.
  205. </para>
  206. <para>
  207. A new preset BeanShell variable, <varname>wm</varname> is set to the
  208. <function>view.getDockableWindowManager()</function>.
  209. </para>
  210. <para>
  211. Previously plugins that wanted to provide BeanShell scripting
  212. commands had to source a BeanShell script on startup. This was
  213. slow. Now, BeanShell supports a <quote>command path</quote>.
  214. When an unresolved method name is entered, the command path is
  215. consulted for the method definition. Entries are added to the
  216. command path using the following method of the
  217. <ulink
  218. url="../api/org/gjt/sp/jedit/NameSpace.html">NameSpace</ulink>
  219. class:
  220. </para>
  221. <para>
  222. <funcsynopsis>
  223. <funcprototype>
  224. <funcdef>void <function>addCommandPath</function></funcdef>
  225. <paramdef>String <parameter>path</parameter></paramdef>
  226. <paramdef>Class <parameter>clas</parameter></paramdef>
  227. </funcprototype>
  228. </funcsynopsis>
  229. </para>
  230. <para>
  231. For example, if your plugin provides commands in the
  232. <filename>commands</filename> directory of the JAR file, you
  233. could call something like this:
  234. </para>
  235. <programlisting>BeanShell.getNameSpace().addCommandPath("/commands/",
  236. MyPlugin.class);</programlisting>
  237. </sect1>
  238. <sect1 id="plugin-api"><title>Dynamic Plugin Loading</title>
  239. <para>
  240. In jEdit 4.1 and earlier, plugins are always fully loaded at program
  241. startup, and unloaded at program shutdown. While the plugin loader and
  242. API was very simple as a result, this scheme had two main
  243. disadvantages:
  244. </para>
  245. <itemizedlist>
  246. <listitem><para>Having a large number of plugins generally slowed down
  247. jEdit startup, since many plugins performed a lot of lengthy
  248. initialization.
  249. Even if all plugins made their <function>start()</function>
  250. methods as quick as possible, there would still be the overhead of
  251. scanning the JAR files, loading the plugin classes, and so on.</para>
  252. </listitem>
  253. <listitem><para>There was no way to reload plugins in a running jEdit
  254. instance. This made plugin development and use of the plugin manager
  255. a bit cumbersome.</para>
  256. </listitem>
  257. </itemizedlist>
  258. <para>
  259. Through a stroke of insight, one notices that the only
  260. functions called from most plugins' <function>start()</function>
  261. methods fall into two categories:
  262. </para>
  263. <itemizedlist>
  264. <listitem><para>Registration of virtual file systems, fold handlers,
  265. macro handlers, Console shells, SideKick parsers, ...</para>
  266. </listitem>
  267. <listitem><para>Arbitriary initialization that only needs to be
  268. done when the plugin is first invoked by the user, and not at
  269. program startup.</para></listitem>
  270. </itemizedlist>
  271. <para>
  272. jEdit 4.2 moves the former task out of the <function>start()</function>
  273. method and into a file within the JAR that can be parsed quickly. This
  274. allows the plugin core class to only be loaded, and its
  275. <function>start()</function> method called, only when
  276. the plugin is first invoked. Note that the <function>start()</function>
  277. method is always called from the event dispatch thread (or from
  278. the main thread if the GUI has not yet been loaded). Therefore you
  279. do not need to worry about thread-safety issues.
  280. </para>
  281. <para>
  282. Also, plugins can now be loaded and unloaded at runtime.
  283. </para>
  284. </sect1>
  285. <sect1 id="class-editplugin"><title>EditPlugin Class Changes</title>
  286. <para>
  287. Documentation for the properties mentioned below, and their possible values,
  288. can be found in the
  289. documentation for the <ulink
  290. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink> class.
  291. </para>
  292. <para>
  293. jEdit distinguishes between jEdit 4.1 and 4.2-style plugins by checking
  294. for the presence of a single property,
  295. <property>plugin.<replaceable>class
  296. name</replaceable>.activate</property>. If this property is present, the
  297. plugin is loaded using the new API.
  298. </para>
  299. <para>
  300. Since the plugin's menu might need to be displayed before its core class
  301. is fully loaded, there is a new way of specifying the plugin menu using
  302. properties; the <function>createMenuItems()</function> method of the
  303. <ulink
  304. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink>
  305. class has been deprecated.
  306. </para>
  307. <para>
  308. For example, the jEdit 4.1 version of the QuickNotepad plugin had the
  309. following <function>createMenuItems()</function> method:
  310. </para>
  311. <programlisting>public void createMenuItems(Vector menuItems)
  312. {
  313. menuItems.addElement(GUIUtilities.loadMenu("quicknotepad.menu"));
  314. }</programlisting>
  315. <para>
  316. Additionally, the following two properties were defined in
  317. <filename>QuickNotepad.props</filename>:
  318. </para>
  319. <programlisting>quicknotepad.menu.label=QuickNotepad
  320. quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
  321. quicknotepad.save-file quicknotepad.copy-to-buffer</programlisting>
  322. <para>
  323. The jEdit 4.2 version of this plugin no longer has a
  324. <function>createMenuItems()</function> method, and instead defines the
  325. following property:
  326. </para>
  327. <programlisting>plugin.QuickNotepadPlugin.menu=quicknotepad \
  328. - \
  329. quicknotepad.choose-file \
  330. quicknotepad.save-file \
  331. quicknotepad.copy-to-buffer</programlisting>
  332. <para>
  333. Note that specifying a <property>.label</property> property for the menu
  334. is no longer necessary, as the label becomes the name of the plugin.
  335. </para>
  336. <para>
  337. If the content of your plugin's menu is determined at runtime, you must
  338. use the new dynamic menu API by defining a property like so:
  339. </para>
  340. <programlisting>plugin.MyPlugin.menu.code=new MyPluginMenuProvider();</programlisting>
  341. <para>
  342. The value of the property is a BeanShell snippet that should evaluate to a
  343. <ulink
  344. url="../api/org/gjt/sp/jedit/menu/DynamicMenuProvider.html">DynamicMenuProvider</ulink>
  345. instance.
  346. </para>
  347. <para>
  348. Similarly, option panes should are now specified using properties, and
  349. the <function>createOptionPanes()</function> method of the
  350. <ulink
  351. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink>
  352. class has been deprecated.
  353. </para>
  354. <para>
  355. In QuickNotepad's case, the <function>createOptionPanes()</function>
  356. method has been removed:
  357. </para>
  358. <programlisting>public void createOptionPanes(OptionsDialog od)
  359. {
  360. od.addOptionPane(new QuickNotepadOptionPane());
  361. }</programlisting>
  362. <para>
  363. The new properties look like this:
  364. </para>
  365. <programlisting>plugin.QuickNotepadPlugin.option-pane=quicknotepad
  366. options.quicknotepad.code=new QuickNotepadOptionPane();</programlisting>
  367. </sect1>
  368. <sect1 id="actions"><title>Actions</title>
  369. <para>
  370. The syntax of the <filename>actions.xml</filename> file has not changed.
  371. </para>
  372. <para>
  373. A few methods of the <ulink
  374. url="../api/org/gjt/sp/jedit/EditAction.html">EditAction</ulink>
  375. class were made
  376. final, since these three values must be known even if the action
  377. instance in question has not been loaded:
  378. </para>
  379. <itemizedlist>
  380. <listitem><para><function>getLabel()</function></para></listitem>
  381. <listitem><para><function>isToggle()</function></para></listitem>
  382. <listitem><para><function>getMouseOverText()</function></para></listitem>
  383. </itemizedlist>
  384. <para>
  385. This change does not affect plugins that define actions using an
  386. <filename>actions.xml</filename> file. However, if your plugin creates
  387. action instances dynamically, you will need to make calls like the
  388. following instead of overriding these methods:
  389. </para>
  390. <programlisting>jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.label",
  391. "<replaceable>Hello World</replaceable>");
  392. jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.toggle",
  393. "<replaceable>true or false</replaceable>");
  394. jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.mouse-over",
  395. "<replaceable>some string</replaceable>");</programlisting>
  396. <para>
  397. Make sure to use <function>jEdit.setTemporaryProperty()</function> and
  398. not <function>jEdit.setProperty()</function> since the latter will save
  399. the values to the user properties file, which is probably not what you
  400. want.
  401. </para>
  402. <para>
  403. The <function>jEdit.getActions()</function> method has been
  404. deprecated, since it must load all plugin <filename>actions.xml</filename>
  405. files in order to return an array of <ulink
  406. url="../api/org/gjt/sp/jedit/EditAction.html">EditAction</ulink>
  407. instances. Use <function>jEdit.getActionNames()</function> instead,
  408. which returns an array of strings.
  409. </para>
  410. <para>
  411. A new abstract method was added to the <ulink
  412. url="../api/org/gjt/sp/jedit/gui/InputHandler.html">InputHandler</ulink>
  413. class:
  414. </para>
  415. <para>
  416. <funcsynopsis>
  417. <funcprototype>
  418. <funcdef>void <function>addKeyBinding</function></funcdef>
  419. <paramdef>String <parameter>keyBinding</parameter></paramdef>
  420. <paramdef>String <parameter>action</parameter></paramdef>
  421. </funcprototype>
  422. </funcsynopsis>
  423. </para>
  424. <para>
  425. The <function>removeKeyBinding()</function> method of the <ulink
  426. url="../api/org/gjt/sp/jedit/gui/DefaultInputHandler.html">DefaultInputHandler</ulink>
  427. class has finally been implemented. Previously it always threw
  428. an <classname>InternalError</classname> when invoked.
  429. </para>
  430. </sect1>
  431. <sect1 id="dockables"><title>Dockable Windows</title>
  432. <para>
  433. The syntax of the <filename>dockables.xml</filename> file has not changed.
  434. </para>
  435. <para>
  436. Instead of overriding the deprecated
  437. <function>JComponent.requestDefaultFocus()</function> method,
  438. dockable windows can now implement the new <ulink
  439. url="../api/org/gjt/sp/jedit/gui/DefaultFocusComponent.html">DefaultFocusComponent</ulink>
  440. interface and its
  441. <function>focusOnDefaultComponent()</function> method.
  442. </para>
  443. </sect1>
  444. <sect1 id="services"><title>Services</title>
  445. <para>
  446. A new <filename>services.xml</filename> file can be provided in the
  447. plugin JAR file. The preferred way of adding virtual file systems, fold
  448. handlers and many other types of extensions is through this file. Its
  449. syntax is described in the documentation for the <ulink
  450. url="../api/org/gjt/sp/jedit/ServiceManager.html">ServiceManager</ulink>
  451. class.
  452. </para>
  453. </sect1>
  454. <sect1 id="vfs"><title>Virtual File Systems</title>
  455. <para>
  456. Instead of calling <function>VFSManager.registerVFS()</function> in your
  457. plugin's <function>start()</function> method, add entries in the
  458. <filename>services.xml</filename> file that look like so:
  459. </para>
  460. <programlisting><![CDATA[<SERVICE CLASS="org.gjt.sp.jedit.io.VFS" NAME="ftp">
  461. new ftp.FtpVFS(false);
  462. </SERVICE>]]></programlisting>
  463. <para>
  464. A new <ulink
  465. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntryCompare.html">VFS.DirectoryEntryCompare</ulink>
  466. class was added,
  467. for sorting lists of VFS directory entries.
  468. </para>
  469. <para>
  470. Fields named <varname>canRead</varname> and <varname>canWrite</varname>
  471. were added to the <ulink
  472. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntry.html">VFS.DirectoryEntry</ulink>
  473. class.
  474. </para>
  475. <para>
  476. There is a new extended attribute API to go with the details view in the
  477. file system browser. Pass an array of extended attribute names to the
  478. <ulink
  479. url="../api/org/gjt/sp/jedit/io/VFS.html">VFS</ulink> constructor, then
  480. provide an implementation
  481. of the <function>getExtendedAttribute()</function> method in your
  482. subclass of <ulink
  483. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntry.html">VFS.DirectoryEntry</ulink>.
  484. </para>
  485. <para>
  486. The following two methods in the <ulink
  487. url="../api/org/gjt/sp/jedit/io/VFSManager.html">VFSManager</ulink>
  488. class have been deprecated since they can no longer be implemented for
  489. file systems using the deferred loading API
  490. </para>
  491. <itemizedlist>
  492. <listitem><para><function>getVFSByName()</function> - use
  493. <function>getVFSForProtocol()</function>
  494. instead.</para></listitem>
  495. <listitem><para><function>getFilesystems()</function> - use
  496. <function>getVFSs()</function>, which returns a string array,
  497. instead.</para></listitem>
  498. </itemizedlist>
  499. </sect1>
  500. <sect1 id="extensions"><title>Text Area Extensions</title>
  501. <para>
  502. The API for text area extensions is still the same, however you
  503. must make sure your plugin correctly adds itself to existing
  504. text areas when it is loaded after jEdit startup, and that it
  505. removes itself from open views if it is unloaded before jEdit
  506. exits.
  507. </para>
  508. <para>
  509. A new method was added to the <ulink
  510. url="../api/org/gjt/sp/jedit/textarea/TextAreaExtension.html">TextAreaExtension</ulink>
  511. class:
  512. </para>
  513. <para>
  514. <funcsynopsis>
  515. <funcprototype>
  516. <funcdef>void <function>paintScreenLineRange</function></funcdef>
  517. <paramdef>Graphics2D <parameter>gfx</parameter></paramdef>
  518. <paramdef>int <parameter>firstLine</parameter></paramdef>
  519. <paramdef>int <parameter>lastLine</parameter></paramdef>
  520. <paramdef>int[] <parameter>physicalLines</parameter></paramdef>
  521. <paramdef>int[] <parameter>start</parameter></paramdef>
  522. <paramdef>int[] <parameter>end</parameter></paramdef>
  523. <paramdef>int <parameter>y</parameter></paramdef>
  524. <paramdef>int <parameter>lineHeight</parameter></paramdef>
  525. </funcprototype>
  526. </funcsynopsis>
  527. </para>
  528. <para>
  529. See the class documentation for information on each parameter.
  530. </para>
  531. <para>
  532. You can override this method to paint a range of
  533. lines at once, instead of having to respond to each individual
  534. <function>paintValidLine()</function> and
  535. <function>paintInvalidLine</function> call.
  536. </para>
  537. <para>
  538. While for many text area extensions using this method will result
  539. in no speedup, some like the error highlight in the ErrorList
  540. plugin become more efficient. The error highlight searches an
  541. array each time it has to paint a line. Previously the array
  542. was searched for each line painted in screen. Using this method,
  543. it is possible to search the array only once when painting a
  544. range of lines.
  545. </para>
  546. </sect1>
  547. <sect1 id="syntax-api"><title>Syntax Highlighting</title>
  548. <para>
  549. The <classname>org.gjt.sp.jedit.syntax</classname> package can now
  550. be used in other programs.
  551. All you need to provide is error handling and logic for locating
  552. the XML mode files. See the
  553. <ulink url="../api/org/gjt/sp/jedit/syntax/package-summary.html">package
  554. documentation</ulink> for details.
  555. </para>
  556. </sect1>
  557. <sect1 id="textarea-api"><title>Text Area and Folding</title>
  558. <para>The
  559. <ulink
  560. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  561. class has a new <function>addToLeftOfScrollBar()</function> method that
  562. adds a component to the left of the scroll bar. Previously plugins like
  563. JDiff had to resort to undocumented hacks to do this.
  564. </para>
  565. <para>
  566. The code that displays lines of text on screen has been overhauled for
  567. improved performance and correctness. As a result, two methods in
  568. <ulink
  569. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  570. that have been deprecated since jEdit 4.0 were removed:
  571. </para>
  572. <itemizedlist>
  573. <listitem><para><function>xToOffset()</function></para>
  574. </listitem>
  575. <listitem><para><function>offsetToX()</function></para>
  576. </listitem>
  577. </itemizedlist>
  578. <para>
  579. As in jEdit 4.0 and 4.1, the <function>xyToOffset()</function> and
  580. <function>offseToXY()</function> methods replace these two.
  581. </para>
  582. <para>
  583. Also, the way folds are handled has changed. The
  584. <classname>FoldVisibilityManager</classname> class has been removed,
  585. and a number of methods in the <ulink
  586. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  587. class have been removed also:
  588. </para>
  589. <itemizedlist>
  590. <listitem><para><function>virtualToPhysical()</function></para>
  591. </listitem>
  592. <listitem><para><function>physicalToVirtual()</function></para>
  593. </listitem>
  594. <listitem><para><function>getVirtualLineCount()</function></para>
  595. </listitem>
  596. </itemizedlist>
  597. <para>
  598. The replacement for the <classname>FoldVisibilityManager</classname>
  599. class is a class named <ulink
  600. url="../api/org/gjt/sp/jedit/io/DisplayManager.html">DisplayManager</ulink>,
  601. with a similar but not identical API.
  602. </para>
  603. <para>
  604. Previously, a <quote>virtual line number</quote> was a line number such
  605. that each physical line (delimited by <literal>\n</literal>) counted
  606. as 1 if it was visible, and 0 if it was not. They did not take into
  607. account lines that were split on screen as a result of soft wrap, and
  608. this made the soft wrap scrolling code rather complicated.
  609. </para>
  610. <para>
  611. In jEdit 4.2, virtual line numbers are no longer used internally; now,
  612. similar <quote>scroll line numbers</quote> are used. Scroll line numbers
  613. take both hidden lines and soft wrap into account. The
  614. <function>getFirstLine()</function> and
  615. <function>setFirstLine()</function> methods of the
  616. <ulink
  617. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  618. class now work with
  619. scroll line numbers.
  620. </para>
  621. <para>
  622. An internal API for converting between scroll line numbers and physical
  623. line numbers exists, but it is rather complicated and it will not be
  624. made public. Instead, if you want the text area to scroll to a given
  625. physical line number, use the new
  626. <function>setFirstPhysicalLine()</function> method in the
  627. <ulink
  628. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  629. class.
  630. </para>
  631. <para>
  632. Instead of calling <function>FoldHandler.registerFoldHandler()</function>
  633. in your
  634. plugin's <function>start()</function> method, add entries in the
  635. <filename>services.xml</filename> file that look like so:
  636. </para>
  637. <programlisting><![CDATA[<SERVICE CLASS="org.gjt.sp.jedit.buffer.FoldHandler" NAME="sidekick">
  638. new sidekick.SideKickFoldHandler()
  639. </SERVICE>]]></programlisting>
  640. </sect1>
  641. <sect1 id="misc-api-changes"><title>Miscellaneous API Changes</title>
  642. <para>
  643. A new <function>View.goToBuffer()</function> method has been added.
  644. If the specified buffer is already
  645. visible in one of the view's edit panes, it sends focus to that edit
  646. pane. Otherwise, it calls <function>setBuffer()</function>
  647. on the current edit pane.
  648. </para>
  649. <para>
  650. The constructor of the <ulink
  651. url="../api/org/gjt/sp/jedit/io/EBMessage.html">EBMessage</ulink> class
  652. now takes
  653. an <classname>Object</classname>, as opposed to an
  654. <ulink
  655. url="../api/org/gjt/sp/jedit/io/EBComponent.html">EBComponent</ulink>.
  656. Plugins that provide custom message
  657. types will need to be recompiled.
  658. </para>
  659. <para>
  660. The following deprecated method was removed from the
  661. <ulink
  662. url="../api/org/gjt/sp/jedit/io/GUIUtilities.html">GUIUtilities</ulink>
  663. class:
  664. </para>
  665. <para>
  666. <funcsynopsis>
  667. <funcprototype>
  668. <funcdef>void <function>loadMenu</function></funcdef>
  669. <paramdef>View <parameter>view</parameter></paramdef>
  670. <paramdef>String <parameter>name</parameter></paramdef>
  671. </funcprototype>
  672. </funcsynopsis>
  673. </para>
  674. </sect1>
  675. </chapter>
  676. </book>