PageRenderTime 47ms CodeModel.GetById 16ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-3-pre5/doc/news42/news.xml

#
XML | 838 lines | 674 code | 163 blank | 1 comment | 0 complexity | 736d98ae0e4f54fdc8e8348995f3248c 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. Many new syntax highlighting modes were added, and many existing ones were enhanced. jEdit now supports syntax highlighting for 133 languages.
  107. </para>
  108. <para>
  109. The following new token types were added:
  110. </para>
  111. <itemizedlist>
  112. <listitem><para>COMMENT3</para></listitem>
  113. <listitem><para>COMMENT4</para></listitem>
  114. <listitem><para>LITERAL3</para></listitem>
  115. <listitem><para>LITERAL4</para></listitem>
  116. <listitem><para>KEYWORD4</para></listitem>
  117. </itemizedlist>
  118. <para>
  119. Any capture groups defined in the <literal>SPAN_REGEXP</literal>
  120. 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.
  121. </para>
  122. <para>
  123. A new <literal>NO_ESCAPE</literal> attribute has been added to the <literal>SPAN</literal> and <literal>SPAN_REGEXP</literal> elements.
  124. </para>
  125. <para>
  126. A new <literal>IMPORT</literal> rule causes the current ruleset to inherit the rules from the given ruleset.
  127. </para>
  128. <para>
  129. 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.
  130. </para>
  131. </sect1>
  132. <sect1 id="search"><title>Search and Replace</title>
  133. <para>
  134. 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.
  135. </para>
  136. <para>
  137. 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.
  138. </para>
  139. <para>
  140. 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.
  141. </para>
  142. </sect1>
  143. <sect1 id="files"><title>File Management</title>
  144. <para>
  145. 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:
  146. </para>
  147. <itemizedlist>
  148. <listitem><para><guilabel>Do nothing</guilabel> - jEdit will not check if files are modified on disk by another program.</para></listitem>
  149. <listitem><para><guilabel>Prompt</guilabel> - a dialog box will be shown listing all changed files, offering to reload them.</para></listitem>
  150. <listitem><para><guilabel>Automatically reload</guilabel> - a dialog box will be shown listing all changed files, and they are all automatically reloaded.</para></listitem>
  151. </itemizedlist>
  152. <para>
  153. 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.
  154. </para>
  155. </sect1>
  156. <sect1 id="encodings"><title>Handling of Multiple Encodings</title>
  157. <para>
  158. 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.
  159. </para>
  160. <para>
  161. Files saved in the <literal>UTF-8Y</literal> encoding are now supported. This encoding is identical to <literal>UTF-8</literal> except there
  162. is a three-byte signature (<literal>0xEFBBBF</literal>) at the beginning of the file.
  163. </para>
  164. <para>
  165. UTF8-Y-encoded files are auto-detected as being such.
  166. </para>
  167. <para>
  168. The encoding used by XML files is also auto-detected if the file provides an XML declaration like the following:
  169. </para>
  170. <programlisting><![CDATA[<?xml version="1.0" encoding="UTF-8"?>]]></programlisting>
  171. </sect1>
  172. <sect1 id="vfs.browser"><title>File System Browser</title>
  173. <para>
  174. 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.
  175. </para>
  176. <para>
  177. 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.
  178. </para>
  179. <para>
  180. 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.
  181. </para>
  182. </sect1>
  183. <sect1 id="bundled-macros"><title>Bundled Macros</title>
  184. <para>
  185. 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.
  186. </para>
  187. <para>
  188. Of course you can create new macros of your own, either by recording actions or writing them from scratch.
  189. </para>
  190. </sect1>
  191. </chapter>
  192. <chapter id="api-changes"><title>API Changes</title>
  193. <sect1 id="beanshell"><title>BeanShell</title>
  194. <para>
  195. BeanShell has been updated from version 1.2b7 to 2.0b1. The
  196. new release of BeanShell brings support for scripted
  197. classes, static imports, mixins, better
  198. error reporting, improved performance, and various fixes.
  199. </para>
  200. <para>
  201. A number of jEdit-specific changes are also present in this
  202. BeanShell version; they will eventually be merged back into
  203. the main BeanShell source tree.
  204. </para>
  205. <para>
  206. A new preset BeanShell variable, <varname>wm</varname> is set to the
  207. <function>view.getDockableWindowManager()</function>.
  208. </para>
  209. <para>
  210. Previously plugins that wanted to provide BeanShell scripting
  211. commands had to source a BeanShell script on startup. This was
  212. slow. Now, BeanShell supports a <quote>command path</quote>.
  213. When an unresolved method name is entered, the command path is
  214. consulted for the method definition. Entries are added to the
  215. command path using the following method of the
  216. <ulink
  217. url="../api/org/gjt/sp/jedit/NameSpace.html">NameSpace</ulink>
  218. class:
  219. </para>
  220. <para>
  221. <funcsynopsis>
  222. <funcprototype>
  223. <funcdef>void <function>addCommandPath</function></funcdef>
  224. <paramdef>String <parameter>path</parameter></paramdef>
  225. <paramdef>Class <parameter>clas</parameter></paramdef>
  226. </funcprototype>
  227. </funcsynopsis>
  228. </para>
  229. <para>
  230. For example, if your plugin provides commands in the
  231. <filename>commands</filename> directory of the JAR file, you
  232. could call something like this:
  233. </para>
  234. <programlisting>BeanShell.getNameSpace().addCommandPath("/commands/",
  235. MyPlugin.class);</programlisting>
  236. </sect1>
  237. <sect1 id="plugin-api"><title>Dynamic Plugin Loading</title>
  238. <para>
  239. In jEdit 4.1 and earlier, plugins are always fully loaded at program
  240. startup, and unloaded at program shutdown. While the plugin loader and
  241. API was very simple as a result, this scheme had two main
  242. disadvantages:
  243. </para>
  244. <itemizedlist>
  245. <listitem><para>Having a large number of plugins generally slowed down
  246. jEdit startup, since many plugins performed a lot of lengthy
  247. initialization.
  248. Even if all plugins made their <function>start()</function>
  249. methods as quick as possible, there would still be the overhead of
  250. scanning the JAR files, loading the plugin classes, and so on.</para>
  251. </listitem>
  252. <listitem><para>There was no way to reload plugins in a running jEdit
  253. instance. This made plugin development and use of the plugin manager
  254. a bit cumbersome.</para>
  255. </listitem>
  256. </itemizedlist>
  257. <para>
  258. Through a stroke of insight, one notices that the only
  259. functions called from most plugins' <function>start()</function>
  260. methods fall into two categories:
  261. </para>
  262. <itemizedlist>
  263. <listitem><para>Registration of virtual file systems, fold handlers,
  264. macro handlers, Console shells, SideKick parsers, ...</para>
  265. </listitem>
  266. <listitem><para>Arbitriary initialization that only needs to be
  267. done when the plugin is first invoked by the user, and not at
  268. program startup.</para></listitem>
  269. </itemizedlist>
  270. <para>
  271. jEdit 4.2 moves the former task out of the <function>start()</function>
  272. method and into a file within the JAR that can be parsed quickly. This
  273. allows the plugin core class to only be loaded, and its
  274. <function>start()</function> method called, only when
  275. the plugin is first invoked. Note that the <function>start()</function>
  276. method is always called from the event dispatch thread (or from
  277. the main thread if the GUI has not yet been loaded). Therefore you
  278. do not need to worry about thread-safety issues.
  279. </para>
  280. <para>
  281. Also, plugins can now be loaded and unloaded at runtime.
  282. </para>
  283. </sect1>
  284. <sect1 id="class-editplugin"><title>EditPlugin Class Changes</title>
  285. <para>
  286. Documentation for the properties mentioned below, and their possible values,
  287. can be found in the
  288. documentation for the <ulink
  289. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink> class.
  290. </para>
  291. <para>
  292. jEdit distinguishes between jEdit 4.1 and 4.2-style plugins by checking
  293. for the presence of a single property,
  294. <property>plugin.<replaceable>class
  295. name</replaceable>.activate</property>. If this property is present, the
  296. plugin is loaded using the new API.
  297. </para>
  298. <para>
  299. Since the plugin's menu might need to be displayed before its core class
  300. is fully loaded, there is a new way of specifying the plugin menu using
  301. properties; the <function>createMenuItems()</function> method of the
  302. <ulink
  303. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink>
  304. class has been deprecated.
  305. </para>
  306. <para>
  307. For example, the jEdit 4.1 version of the QuickNotepad plugin had the
  308. following <function>createMenuItems()</function> method:
  309. </para>
  310. <programlisting>public void createMenuItems(Vector menuItems)
  311. {
  312. menuItems.addElement(GUIUtilities.loadMenu("quicknotepad.menu"));
  313. }</programlisting>
  314. <para>
  315. Additionally, the following two properties were defined in
  316. <filename>QuickNotepad.props</filename>:
  317. </para>
  318. <programlisting>quicknotepad.menu.label=QuickNotepad
  319. quicknotepad.menu=quicknotepad - quicknotepad.choose-file \
  320. quicknotepad.save-file quicknotepad.copy-to-buffer</programlisting>
  321. <para>
  322. The jEdit 4.2 version of this plugin no longer has a
  323. <function>createMenuItems()</function> method, and instead defines the
  324. following property:
  325. </para>
  326. <programlisting>plugin.QuickNotepadPlugin.menu=quicknotepad \
  327. - \
  328. quicknotepad.choose-file \
  329. quicknotepad.save-file \
  330. quicknotepad.copy-to-buffer</programlisting>
  331. <para>
  332. Note that specifying a <property>.label</property> property for the menu
  333. is no longer necessary, as the label becomes the name of the plugin.
  334. </para>
  335. <para>
  336. If the content of your plugin's menu is determined at runtime, you must
  337. use the new dynamic menu API by defining a property like so:
  338. </para>
  339. <programlisting>plugin.MyPlugin.menu.code=new MyPluginMenuProvider();</programlisting>
  340. <para>
  341. The value of the property is a BeanShell snippet that should evaluate to a
  342. <ulink
  343. url="../api/org/gjt/sp/jedit/menu/DynamicMenuProvider.html">DynamicMenuProvider</ulink>
  344. instance.
  345. </para>
  346. <para>
  347. Similarly, option panes should are now specified using properties, and
  348. the <function>createOptionPanes()</function> method of the
  349. <ulink
  350. url="../api/org/gjt/sp/jedit/EditPlugin.html">EditPlugin</ulink>
  351. class has been deprecated.
  352. </para>
  353. <para>
  354. In QuickNotepad's case, the <function>createOptionPanes()</function>
  355. method has been removed:
  356. </para>
  357. <programlisting>public void createOptionPanes(OptionsDialog od)
  358. {
  359. od.addOptionPane(new QuickNotepadOptionPane());
  360. }</programlisting>
  361. <para>
  362. The new properties look like this:
  363. </para>
  364. <programlisting>plugin.QuickNotepadPlugin.option-pane=quicknotepad
  365. options.quicknotepad.code=new QuickNotepadOptionPane();</programlisting>
  366. </sect1>
  367. <sect1 id="actions"><title>Actions</title>
  368. <para>
  369. The syntax of the <filename>actions.xml</filename> file has not changed.
  370. </para>
  371. <para>
  372. A few methods of the <ulink
  373. url="../api/org/gjt/sp/jedit/EditAction.html">EditAction</ulink>
  374. class were made
  375. final, since these three values must be known even if the action
  376. instance in question has not been loaded:
  377. </para>
  378. <itemizedlist>
  379. <listitem><para><function>getLabel()</function></para></listitem>
  380. <listitem><para><function>isToggle()</function></para></listitem>
  381. <listitem><para><function>getMouseOverText()</function></para></listitem>
  382. </itemizedlist>
  383. <para>
  384. This change does not affect plugins that define actions using an
  385. <filename>actions.xml</filename> file. However, if your plugin creates
  386. action instances dynamically, you will need to make calls like the
  387. following instead of overriding these methods:
  388. </para>
  389. <programlisting>jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.label",
  390. "<replaceable>Hello World</replaceable>");
  391. jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.toggle",
  392. "<replaceable>true or false</replaceable>");
  393. jEdit.setTemporaryProperty("<replaceable>action name</replaceable>.mouse-over",
  394. "<replaceable>some string</replaceable>");</programlisting>
  395. <para>
  396. Make sure to use <function>jEdit.setTemporaryProperty()</function> and
  397. not <function>jEdit.setProperty()</function> since the latter will save
  398. the values to the user properties file, which is probably not what you
  399. want.
  400. </para>
  401. <para>
  402. The <function>jEdit.getActions()</function> method has been
  403. deprecated, since it must load all plugin <filename>actions.xml</filename>
  404. files in order to return an array of <ulink
  405. url="../api/org/gjt/sp/jedit/EditAction.html">EditAction</ulink>
  406. instances. Use <function>jEdit.getActionNames()</function> instead,
  407. which returns an array of strings.
  408. </para>
  409. <para>
  410. A new abstract method was added to the <ulink
  411. url="../api/org/gjt/sp/jedit/gui/InputHandler.html">InputHandler</ulink>
  412. class:
  413. </para>
  414. <para>
  415. <funcsynopsis>
  416. <funcprototype>
  417. <funcdef>void <function>addKeyBinding</function></funcdef>
  418. <paramdef>String <parameter>keyBinding</parameter></paramdef>
  419. <paramdef>String <parameter>action</parameter></paramdef>
  420. </funcprototype>
  421. </funcsynopsis>
  422. </para>
  423. <para>
  424. The <function>removeKeyBinding()</function> method of the <ulink
  425. url="../api/org/gjt/sp/jedit/gui/DefaultInputHandler.html">DefaultInputHandler</ulink>
  426. class has finally been implemented. Previously it always threw
  427. an <classname>InternalError</classname> when invoked.
  428. </para>
  429. </sect1>
  430. <sect1 id="dockables"><title>Dockable Windows</title>
  431. <para>
  432. The syntax of the <filename>dockables.xml</filename> file has not changed.
  433. </para>
  434. <para>
  435. Instead of overriding the deprecated
  436. <function>JComponent.requestDefaultFocus()</function> method,
  437. dockable windows can now implement the new <ulink
  438. url="../api/org/gjt/sp/jedit/gui/DefaultFocusComponent.html">DefaultFocusComponent</ulink>
  439. interface and its
  440. <function>focusOnDefaultComponent()</function> method.
  441. </para>
  442. </sect1>
  443. <sect1 id="services"><title>Services</title>
  444. <para>
  445. A new <filename>services.xml</filename> file can be provided in the
  446. plugin JAR file. The preferred way of adding virtual file systems, fold
  447. handlers and many other types of extensions is through this file. Its
  448. syntax is described in the documentation for the <ulink
  449. url="../api/org/gjt/sp/jedit/ServiceManager.html">ServiceManager</ulink>
  450. class.
  451. </para>
  452. </sect1>
  453. <sect1 id="vfs"><title>Virtual File Systems</title>
  454. <para>
  455. Instead of calling <function>VFSManager.registerVFS()</function> in your
  456. plugin's <function>start()</function> method, add entries in the
  457. <filename>services.xml</filename> file that look like so:
  458. </para>
  459. <programlisting><![CDATA[<SERVICE CLASS="org.gjt.sp.jedit.io.VFS" NAME="ftp">
  460. new ftp.FtpVFS(false);
  461. </SERVICE>]]></programlisting>
  462. <para>
  463. A new <ulink
  464. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntryCompare.html">VFS.DirectoryEntryCompare</ulink>
  465. class was added,
  466. for sorting lists of VFS directory entries.
  467. </para>
  468. <para>
  469. Fields named <varname>canRead</varname> and <varname>canWrite</varname>
  470. were added to the <ulink
  471. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntry.html">VFS.DirectoryEntry</ulink>
  472. class.
  473. </para>
  474. <para>
  475. There is a new extended attribute API to go with the details view in the
  476. file system browser. Pass an array of extended attribute names to the
  477. <ulink
  478. url="../api/org/gjt/sp/jedit/io/VFS.html">VFS</ulink> constructor, then
  479. provide an implementation
  480. of the <function>getExtendedAttribute()</function> method in your
  481. subclass of <ulink
  482. url="../api/org/gjt/sp/jedit/io/VFS.DirectoryEntry.html">VFS.DirectoryEntry</ulink>.
  483. </para>
  484. <para>
  485. The following two methods in the <ulink
  486. url="../api/org/gjt/sp/jedit/io/VFSManager.html">VFSManager</ulink>
  487. class have been deprecated since they can no longer be implemented for
  488. file systems using the deferred loading API
  489. </para>
  490. <itemizedlist>
  491. <listitem><para><function>getVFSByName()</function> - use
  492. <function>getVFSForProtocol()</function>
  493. instead.</para></listitem>
  494. <listitem><para><function>getFilesystems()</function> - use
  495. <function>getVFSs()</function>, which returns a string array,
  496. instead.</para></listitem>
  497. </itemizedlist>
  498. </sect1>
  499. <sect1 id="extensions"><title>Text Area Extensions</title>
  500. <para>
  501. The API for text area extensions is still the same, however you
  502. must make sure your plugin correctly adds itself to existing
  503. text areas when it is loaded after jEdit startup, and that it
  504. removes itself from open views if it is unloaded before jEdit
  505. exits.
  506. </para>
  507. <para>
  508. A new method was added to the <ulink
  509. url="../api/org/gjt/sp/jedit/textarea/TextAreaExtension.html">TextAreaExtension</ulink>
  510. class:
  511. </para>
  512. <para>
  513. <funcsynopsis>
  514. <funcprototype>
  515. <funcdef>void <function>paintScreenLineRange</function></funcdef>
  516. <paramdef>Graphics2D <parameter>gfx</parameter></paramdef>
  517. <paramdef>int <parameter>firstLine</parameter></paramdef>
  518. <paramdef>int <parameter>lastLine</parameter></paramdef>
  519. <paramdef>int[] <parameter>physicalLines</parameter></paramdef>
  520. <paramdef>int[] <parameter>start</parameter></paramdef>
  521. <paramdef>int[] <parameter>end</parameter></paramdef>
  522. <paramdef>int <parameter>y</parameter></paramdef>
  523. <paramdef>int <parameter>lineHeight</parameter></paramdef>
  524. </funcprototype>
  525. </funcsynopsis>
  526. </para>
  527. <para>
  528. See the class documentation for information on each parameter.
  529. </para>
  530. <para>
  531. You can override this method to paint a range of
  532. lines at once, instead of having to respond to each individual
  533. <function>paintValidLine()</function> and
  534. <function>paintInvalidLine</function> call.
  535. </para>
  536. <para>
  537. While for many text area extensions using this method will result
  538. in no speedup, some like the error highlight in the ErrorList
  539. plugin become more efficient. The error highlight searches an
  540. array each time it has to paint a line. Previously the array
  541. was searched for each line painted in screen. Using this method,
  542. it is possible to search the array only once when painting a
  543. range of lines.
  544. </para>
  545. </sect1>
  546. <sect1 id="syntax-api"><title>Syntax Highlighting</title>
  547. <para>
  548. The <classname>org.gjt.sp.jedit.syntax</classname> package can now
  549. be used in other programs.
  550. All you need to provide is error handling and logic for locating
  551. the XML mode files. See the
  552. <ulink url="../api/org/gjt/sp/jedit/syntax/package-summary.html">package
  553. documentation</ulink> for details.
  554. </para>
  555. </sect1>
  556. <sect1 id="textarea-api"><title>Text Area and Folding</title>
  557. <para>The
  558. <ulink
  559. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  560. class has a new <function>addToLeftOfScrollBar()</function> method that
  561. adds a component to the left of the scroll bar. Previously plugins like
  562. JDiff had to resort to undocumented hacks to do this.
  563. </para>
  564. <para>
  565. The code that displays lines of text on screen has been overhauled for
  566. improved performance and correctness. As a result, two methods in
  567. <ulink
  568. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  569. that have been deprecated since jEdit 4.0 were removed:
  570. </para>
  571. <itemizedlist>
  572. <listitem><para><function>xToOffset()</function></para>
  573. </listitem>
  574. <listitem><para><function>offsetToX()</function></para>
  575. </listitem>
  576. </itemizedlist>
  577. <para>
  578. As in jEdit 4.0 and 4.1, the <function>xyToOffset()</function> and
  579. <function>offseToXY()</function> methods replace these two.
  580. </para>
  581. <para>
  582. Also, the way folds are handled has changed. The
  583. <classname>FoldVisibilityManager</classname> class has been removed,
  584. and a number of methods in the <ulink
  585. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  586. class have been removed also:
  587. </para>
  588. <itemizedlist>
  589. <listitem><para><function>virtualToPhysical()</function></para>
  590. </listitem>
  591. <listitem><para><function>physicalToVirtual()</function></para>
  592. </listitem>
  593. <listitem><para><function>getVirtualLineCount()</function></para>
  594. </listitem>
  595. </itemizedlist>
  596. <para>
  597. The replacement for the <classname>FoldVisibilityManager</classname>
  598. class is a class named <ulink
  599. url="../api/org/gjt/sp/jedit/io/DisplayManager.html">DisplayManager</ulink>,
  600. with a similar but not identical API.
  601. </para>
  602. <para>
  603. Previously, a <quote>virtual line number</quote> was a line number such
  604. that each physical line (delimited by <literal>\n</literal>) counted
  605. as 1 if it was visible, and 0 if it was not. They did not take into
  606. account lines that were split on screen as a result of soft wrap, and
  607. this made the soft wrap scrolling code rather complicated.
  608. </para>
  609. <para>
  610. In jEdit 4.2, virtual line numbers are no longer used internally; now,
  611. similar <quote>scroll line numbers</quote> are used. Scroll line numbers
  612. take both hidden lines and soft wrap into account. The
  613. <function>getFirstLine()</function> and
  614. <function>setFirstLine()</function> methods of the
  615. <ulink
  616. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  617. class now work with
  618. scroll line numbers.
  619. </para>
  620. <para>
  621. An internal API for converting between scroll line numbers and physical
  622. line numbers exists, but it is rather complicated and it will not be
  623. made public. Instead, if you want the text area to scroll to a given
  624. physical line number, use the new
  625. <function>setFirstPhysicalLine()</function> method in the
  626. <ulink
  627. url="../api/org/gjt/sp/jedit/textarea/JEditTextArea.html">JEditTextArea</ulink>
  628. class.
  629. </para>
  630. <para>
  631. Instead of calling <function>FoldHandler.registerFoldHandler()</function>
  632. in your
  633. plugin's <function>start()</function> method, add entries in the
  634. <filename>services.xml</filename> file that look like so:
  635. </para>
  636. <programlisting><![CDATA[<SERVICE CLASS="org.gjt.sp.jedit.buffer.FoldHandler" NAME="sidekick">
  637. new sidekick.SideKickFoldHandler()
  638. </SERVICE>]]></programlisting>
  639. </sect1>
  640. <sect1 id="misc-api-changes"><title>Miscellaneous API Changes</title>
  641. <para>
  642. A new <function>View.goToBuffer()</function> method has been added.
  643. If the specified buffer is already
  644. visible in one of the view's edit panes, it sends focus to that edit
  645. pane. Otherwise, it calls <function>setBuffer()</function>
  646. on the current edit pane.
  647. </para>
  648. <para>
  649. The constructor of the <ulink
  650. url="../api/org/gjt/sp/jedit/io/EBMessage.html">EBMessage</ulink> class
  651. now takes
  652. an <classname>Object</classname>, as opposed to an
  653. <ulink
  654. url="../api/org/gjt/sp/jedit/io/EBComponent.html">EBComponent</ulink>.
  655. Plugins that provide custom message
  656. types will need to be recompiled.
  657. </para>
  658. <para>
  659. The following deprecated method was removed from the
  660. <ulink
  661. url="../api/org/gjt/sp/jedit/io/GUIUtilities.html">GUIUtilities</ulink>
  662. class:
  663. </para>
  664. <para>
  665. <funcsynopsis>
  666. <funcprototype>
  667. <funcdef>void <function>loadMenu</function></funcdef>
  668. <paramdef>View <parameter>view</parameter></paramdef>
  669. <paramdef>String <parameter>name</parameter></paramdef>
  670. </funcprototype>
  671. </funcsynopsis>
  672. </para>
  673. </sect1>
  674. </chapter>
  675. </book>