/plugins/SideKick/tags/release-0-7-1/users-guide.xml
# · XML · 575 lines · 446 code · 127 blank · 2 comment · 0 complexity · d99430fb321fd6de246f300b8304921c MD5 · raw file
- <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
- "http://www.oasis-open.org/docbook/xml/4.2/docbookx.dtd">
- <!-- jEdit buffer-local properties: -->
- <!-- :indentSize=2:noTabs=true:folding=sidekick: -->
- <book>
- <bookinfo><title>SideKick plugin user's guide</title>
- <authorgroup>
- <author><firstname>Slava</firstname><surname>Pestov</surname></author>
- <author><firstname>Dale</firstname><surname>Anson</surname></author>
- <author><firstname>Martin</firstname><surname>Raspe</surname></author>
- <author><firstname>Alan</firstname><surname>Ezust</surname></author>
- </authorgroup>
- <legalnotice><title>Legal Notice</title>
- <para>
- Permission is granted to copy, distribute and/or modify this document
- under the terms of the GNU Free Documentation License, Version 1.1 or
- any later version published by the Free Software Foundation; with no
- <quote>Invariant Sections</quote>, <quote>Front-Cover Texts</quote> or
- <quote>Back-Cover Texts</quote>, each as defined in the license. A copy of
- the license can be found in the file <filename>COPYING.DOC.txt</filename>
- included with jEdit.
- </para>
- <para>
- The SideKick plugin itself is released under the GNU General Public License.
- A copy of the GPL can be found in the jEdit online help.
- </para>
- </legalnotice>
- </bookinfo>
- <chapter id="browser"><title>The structure browser window</title>
- <para>
- The SideKick plugin provides a dockable window in which other plugins can
- display buffer structure.
- </para>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Structure
- Browser</guimenuitem> displays the current buffer's structure in a
- dockable window. This window is floating by
- default, but it can be docked into the view 2 ways.
- </para>
- <orderedlist>
- <listitem><para> Choosing a docking area from the docking menu (a little arrow in the upper left corner of each floating dockable)</para></listitem>
- <listitem><para> Go to the <guibutton>Docking</guibutton>
- pane of the <guimenuitem>Global Options</guimenuitem> dialog box </para></listitem>
- </orderedlist>
- <para> On the top of the window, you will see a combobox which lists all installed SideKick parsers. You can switch to another parser temporarily for a buffer by selecting it from the combo box. </para>
- <para>
- The SideKick plugin can automatically parse your buffer depending on various events, such as: Buffer Switch, Buffer Save, or on the fly (after it is idle for a period of time). The last option is rarely used since it can eat up CPU time, so it is disabled by default. </para>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Parse
- on Keystroke</guimenuitem> is a checkbox menu item that toggles on-the-fly parsing, for the current buffer only.
- </para>
- <para> You can also manually parse a buffer by clicking on the "reload" button in the Sidekick Structure browser, or through a keyboard shortcut, if you bind Sidekick's "parse buffer" action to a keystroke. <footnote><para>
- global options - jedit - Shortcuts - Plugin: Sidekick (combo) - Parse Buffer</para></footnote> </para>
- <para>
- The current buffer can be parsed at any other time by clicking the parse
- button in the <guimenuitem>Structure Browser</guimenuitem> window, or by
- invoking the
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Parse
- Buffer</guimenuitem> command.
- </para>
- <tip> <title> Reload button menu </title>
- <para> A popup menu is available in JDK 1.5 which
- appears when you right-click the "reload" button.
- From there, you can set some auto-parse options
- without going to the plugin options. </para></tip>
- <para>
- Any errors found while parsing the buffer are sent to the
- <application>ErrorList</application> plugin, which means they are highlighted
- in the text area, and shown in the
- <guimenu>Plugins</guimenu>><guisubmenu>Error
- List</guisubmenu>> window. See the
- documentation for the <application>ErrorList</application> plugin for details.
- </para>
- <para>
- Clicking on a node in the tree will move the caret to its location in the
- buffer;
- conversely, moving the caret in the buffer will select the corresponding
- node.
- </para>
- <para>
- <keycap>Shift</keycap>-clicking on a node will select that node in the text
- area. <keycap>Alt</keycap>-clicking on a node will narrow the text area
- display to that node.
- </para>
- <para>
- If the structure browser window is docked into the current view, hovering the mouse
- over a node will display its attributes in the status bar.
- </para>
- </chapter>
- <chapter id="moving-around"><title>Moving around</title>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Go
- to Previous Asset</guimenuitem> moves the caret to start of the structure
- element (<quote>asset</quote>).
- </para>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Go
- to Next Asset</guimenuitem> moves the caret to start of the next asset.
- </para>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Select
- Asset at Caret</guimenuitem> selects the asset at the caret position.
- </para>
- </chapter>
- <chapter id="folding"><title>Folding</title>
- <para>
- The SideKick plugin adds a new <quote>sidekick</quote> fold handler that
- folds the buffer according to the structure tree. See the jEdit user's guide
- for general details about folding.
- </para>
- <para>
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Narrow to
- Asset at Caret</guimenuitem> hides all text except that of the asset at the
- caret location. This works in any folding mode, not just the <quote>sidekick</quote>
- mode.
- </para>
- </chapter>
- <chapter id="completion"><title>Completion</title>
- <para>
- A completion popup can be shown at any time
- by invoking the
- <guimenu>Plugins</guimenu>><guisubmenu>SideKick</guisubmenu>><guimenuitem>Show
- Completion Popup</guimenuitem> command. Each plugin that uses SideKick
- implements its own specific completion behavior; see the plugin documentation
- for details.
- </para>
- </chapter>
- <chapter id="other-plugins"><title>Developing SideKick back-ends</title>
- <para>
- By itself the SideKick plugin is not very useful; it relies on other plugins to
- provide buffer structure information. This chapter gives a brief overview of
- how it's done.
- </para>
- <sect1 id="preliminaries"><title>Preliminaries</title>
- <para>
- First you will also need to add a dependency for the SideKick plugin in your plugin's
- property file:
- </para>
- <programlisting>plugin.MyPlugin.depend.<replaceable>n</replaceable>=plugin sidekick.SideKickPlugin 0.1</programlisting>
- <para>
- Note that you must replace <replaceable>n</replaceable> with the
- appropriate number, as dependency properties must have consecutive numbers.
- </para>
- <para>
- All SideKick plugin classes are in the <classname>sidekick</classname> package;
- you will need to add <literal>import</literal> statements where appropriate.
- </para>
- <para>
- Parser instances must be registered using the
- <literal>services.xml</literal> file. With this, you define a service which
- returns a derived instance of <ulink
- url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickParser.html">
- <classname>SideKickParser</classname></ulink>
- </para>
- <programlisting>
- <?xml version="1.0"?>
- <!DOCTYPE SERVICES SYSTEM "services.dtd">
- <SERVICES>
- <SERVICE CLASS="sidekick.SideKickParser" NAME="xml">
- new xml.parser.SAXParserImpl();
- </SERVICE>
- </SERVICES>
- </programlisting>
- </sect1>
- <sect1 id="class-sidekickparser"><title>The SideKickParser class</title>
- <para>
- <ulink
- url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickParser.html">
- <classname>SideKickParser</classname></ulink> is an abstract class. The constructor takes one string parameter. This string is used in several properties:
- </para>
- <itemizedlist>
- <listitem><para><literal>sidekick.parser.<replaceable>name</replaceable>.label</literal>
- - specifies a human-readable label for the parser, shown in status messages. </para>
- <para> Your derived parser class should return this same name from the <literal>getName()</literal> function.
- </para>
- </listitem>
- <listitem><para><literal>mode.<replaceable>mode</replaceable>.sidekick.parser</literal>
- - properties of this form are used to associate a parser with an edit mode.
- </para></listitem>
- </itemizedlist>
- <para>
- For example, the XML plugin, which used to provide two <classname>SideKickParser</classname>
- implementations, had these properties:
- </para>
- <programlisting>sidekick.parser.xml.label=XML
- mode.xml.sidekick.parser=xml
- mode.xsl.sidekick.parser=xml
- sidekick.parser.html.label=HTML
- mode.asp.sidekick.parser=html
- mode.coldfusion.sidekick.parser=html
- mode.html.sidekick.parser=html
- mode.jhtml.sidekick.parser=html
- mode.jsp.sidekick.parser=html
- mode.php.sidekick.parser=html
- mode.shtml.sidekick.parser=html
- mode.sgml.sidekick.parser=html
- mode.velocity.sidekick.parser=html</programlisting>
- </sect1>
- <sect1 id="implement-structure-tree"><title>Implementing a structure tree</title>
- <para>
- The <ulink
- url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickParser.html">
- <classname>SideKickParser</classname></ulink> has one abstract method that all
- subclasses must implement:
- </para>
- <funcsynopsis>
- <funcprototype>
- <funcdef>public
- SideKickParsedData <function>parse</function></funcdef>
- <paramdef>Buffer <parameter>buffer</parameter></paramdef>
- <paramdef>DefaultErrorSource <parameter>errorSource</parameter></paramdef>
- </funcprototype>
- </funcsynopsis>
- <para>
- The <literal>errorSource</literal> is an instance of a class provided by the
- <application>ErrorList</application> plugin; consult its documentation for
- details.
- </para>
- <para>
- The method is called from a thread, so care must be taken to access the
- buffer in a thread-safe manner; the API documentation for the
- <classname>Buffer</classname> class describes how this is done.
- </para>
- <para>
- Your implementation of the <function>parse()</function> method should create and return
- an instance of
- <ulink url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickParsedData.html">SideKickParsedData </ulink>. Its constructor of the takes one parameter, which is the file name (to be shown at the root of the structure tree). Your method should
- add structure elements to the <varname>root</varname> field of the instance.
- <varname>root</varname> is an instance of Java's <classname>DefaultMutableTreeNode</classname> class,
- and is given an initial value by the <classname>SideKickParsedData</classname> constructor.
- </para>
- </sect1>
- <sect1 id="implement-completion"><title>Implementing completion popups</title>
- <para> Your derived instance of
- <ulink url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickParser.html">
- SideKickParser</ulink> can implement additional
- methods to tell Sidekick that your parser supports completions.
- </para>
- <programlisting>
- /* @return true if plugin supports completion */
- public boolean supportsCompletion();
- /* @return true if we show completions after a period of inactivity. */
- public boolean canCompleteAnywhere() ;
- /* @return a list of characters which trigger completion immediately. */
- public String getInstantCompletionTriggers();
- /* @return all completions at a given caret position for this
- editpane */
- public SideKickCompletion complete(EditPane editPane, int caret)
- </programlisting>
- <para> If your SideKickParser does support completion, the actual
- brains of the plugin goes in the last method, <literal>complete()</literal>,
- which must construct an instance of <ulink
- url="jeditresource:/Sidekick.jar!/docs/api/sidekick/SideKickCompletion.html">
- SideKickCompletion</ulink>, given an EditPane and a caret position.
- </para>
- <para>
- The constructor for SideKickCompletion accepts a list (or array) of possible values, these are the values that are displayed in the dropdown.
- This is an abstract class, so you'll need to derive a specific implementation. You may want to override the 'insert(int)' method to
- support language specifics, like "dot" completion.
- </para>
- <para>How you actually create the completion depends on the specific language and support classes, and the information provided by the parser for the current file. </para>
- </sect1>
- </chapter>
- <appendix id="futureplans"><title> Future Plans </title>
- <itemizedlist>
- <listitem><para> Adding a Help tooltip to the CompletionPopup window and methods to the CompletinoInfo for getting/setting help.
- </para></listitem>
- </itemizedlist>
- </appendix>
- <appendix id="changes"><title>Change log</title>
- <itemizedlist>
-
- <listitem><para>
- <emphasis role="bold">Version 0.71</emphasis> requires JDK 1.5, jEdit 4.3pre8 and ErrorListPlugin 1.4.</para>
- <itemizedlist>
- <listitem><para> SF.net bugs 1072043, 1553554, 1506964 - Sidekick FoldHandler bugs fixed. </para></listitem>
- <listitem><para> SF.net bug # 1593604 - reparse on save happens only in the active view.
- </para></listitem>
- <listitem><para> Sf.net bug # 1595835 - can't switch to default parser
- </para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>
- <emphasis role="bold">Version 0.7</emphasis> requires JDK 1.5, jEdit 4.3pre8 and ErrorListPlugin 1.4.</para>
- <itemizedlist>
- <listitem><para>
- Added a mode-specific option pane, so that settings can
- be customized on a mode basis by SideKick and its parser service plugins. (ezust).
- </para>
- </listitem>
- <listitem><para>
- Made the completion popup accept-characters configurable. Prevented the completion popup from showing when the word at the caret is the same as a completion list entry. (hertzhaft) </para>
- </listitem>
- <listitem><para>Recuses into non-asset nodes #1571697, 1573034. (shlomy) </para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>
- <emphasis role="bold">Version 0.6.6</emphasis> requires JDK 1.5, jEdit 4.3pre5 and ErrorListPlugin 1.4.</para>
- <itemizedlist>
- <listitem><para>
- Added sidekick.util package. This contains classes to help integrate javacc-generated parsers with sidekick. (danson) </para>
- </listitem>
- <listitem><para> Some work on the popup for code completion. It still doesn't work right with picking from the list with a mouse. (danson) </para></listitem>
- <listitem><para> Fix for a null pointer exception. (danson) </para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>
- <emphasis role="bold">Version 0.6.4</emphasis> requires JDK 1.5, jEdit 4.3pre5 and ErrorListPlugin 1.4. </para>
- <itemizedlist>
- <listitem><para>
- Emits new EBMessage <classname>msg.CaretChanging</classname> when an asset is selected in the tree. (ezust) </para>
- </listitem>
- <listitem><para> Mouse Clicks, PgUp and PgDn keys work from completion popups. Arrow keys don't wrap around anymore. (ezust) </para></listitem>
- <listitem><para> Popup menu on parse button for conveniently changing auto parse settings/caret follow settings (requires JDK 1.5). (ezust) </para></listitem>
- <listitem><para> Parse event bugfixes (ezust) </para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para>
- <emphasis role="bold">Version 0.6.2</emphasis> requires JDK 1.4, jEdit 4.3pre3 and ErrorListPlugin 1.4.
- <itemizedlist>
- <listitem> <para> Broke up options "parse on buffer switch/save" into 2 separate options. Now you can parse on switch, or on save, or on both, and when you switch buffers with parse-on-switch off, the tree keeps its state. (Alan Ezust) </para> </listitem>
- <listitem> <para> Added option setting to turn off tool tips. Tool tips can be
- annoying on slower systems as they are not necessarily drawn quickly. (Dale Anson) </para></listitem>
- <listitem> <para> Added option setting to be able to display a status window
- at the bottom of the tree. This window is larger than the jEdit status bar,
- so the full display of tree node can be shown. This is nice when tool tips
- are off and the node details are shown on more than one line. (Dale Anson) </para></listitem>
- </itemizedlist>
- </para>
- </listitem>
- <listitem> <para>
- <emphasis role="bold">Version 0.6.1</emphasis> requires
- jEdit 4.3pre3 and ErrorListPlugin 1.4.
- <itemizedlist>
- <listitem><para> Made <varname>SideKickParser.name</varname> <literal>protected</literal>.
- </para></listitem>
- <listitem><para> Bug 1504746 fixed [combobox]. </para></listitem>
- </itemizedlist>
- </para></listitem>
- <listitem>
- <para>
- <emphasis role="bold">Version 0.6</emphasis> requires
- jEdit 4.3pre3 and ErrorListPlugin 1.4.
- <itemizedlist>
- <listitem> <para> Added a combo box to let you switch parsers on an individual buffer basis. (Alan Ezust) </para></listitem>
- <listitem>
- <para> Improved Documentation. (Alan Ezust) </para> </listitem>
- <listitem> <para> No more multi-line StatusBar messages. Using <function>getShortString()</function>
- instead of <function>getLongString()</function>. (Alan Ezust) </para> </listitem>
- </itemizedlist>
- </para>
- </listitem>
- <listitem> <para>
- <emphasis role="bold">Version 0.5</emphasis> requires jEdit 4.3pre3 and ErrorListPlugin 1.2.</para>
- <itemizedlist>
- <listitem> <para> SideKick now auto-expands the proper depth of the tree, and properly follows the textarea's caret as the selected node in the sidekick. (Dale Anson) </para> </listitem>
- <listitem> <para> A new context menu exists in Structure Browser permitting the user to set and view markers. (Martin Raspe) </para> </listitem>
- </itemizedlist> </listitem>
- <listitem> <para> <emphasis role="bold">Version 0.4</emphasis> requires
- jEdit 4.3pre3 and ErrorListPlugin 1.2.</para>
- <itemizedlist>
- <listitem><para> Moved 4 classes from the PerlSideKick plugin into this plugin. The classes are in <literal>package sidekick.enhanced</literal>.
- This is so that we can break the dependency between
- JavaScriptSideKick and PerlSideKick. </para> </listitem>
- <listitem> <para> Patched for 4.3pre3 API </para> </listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.3.4</emphasis> requires
- jEdit 4.2final.</para>
- <itemizedlist>
- <listitem><para>Added a new <classname>IAsset</classname> interface that can be
- used instead of the <classname>Asset</classname> abstract class to realize more flexible
- inheritance relationships.</para></listitem>
- <listitem><para>Added a new option pane to associate edit modes with SideKick parsers.</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.3.3</emphasis> requires
- jEdit 4.2final.</para>
- <itemizedlist>
- <listitem><para>The completion popup is now positioned within the screen bounds.</para></listitem>
- <listitem><para>The <classname>SideKickCompletion</classname> class is now much more full-featured (but backwards-compatible, if you ignore the new features).</para></listitem>
- <listitem><para>Some changes were made to the way the parser works to improve perceived responsiveness.</para></listitem>
- <listitem><para>The <classname>SideKickParsedData</classname> associated with a buffer was not unset when the SideKick plugin was unloaded, and as a result, reloading the
- SideKick plugin would horribly break buffers using the <quote>sidekick</quote> fold handler.</para></listitem>
- <listitem><para>The option to delay parsing after a keystroke did not work; the timeout was always fixed at 1.5 seconds.</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.3.2</emphasis> requires
- jEdit 4.2final and ErrorListPlugin 1.2.</para>
- <itemizedlist>
- <listitem><para>Fixed NullPointerException in <guimenuitem>Select Asset</guimenuitem>.</para></listitem>
- <listitem><para>Sometimes a buffer would be parsed more than once in a row.</para></listitem>
- <listitem><para>Fixed a bug that would show the completion popup twice if the <guilabel>Show completion popups where possible</guilabel> option was on andthe popup trigger delay was larger than 0 seconds and the user invoked the <guilabel>complete</guilabel> action before the trigger delay run out. (Dirk Moebius)</para></listitem>
- <listitem><para>Fixed a bug where typing with the completion popup open would not insert keys if there were no completions available.</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.3.1</emphasis> requires
- jEdit 4.2pre3 and ErrorListPlugin 1.2.</para>
- <itemizedlist>
- <listitem><para><classname>SideKickCompletion</classname> implementations can now disable automatic completion popups.</para></listitem>
- <listitem><para>Fix a problem in buffer listener handling.</para></listitem>
- <listitem><para>Various other minor fixes.</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.3</emphasis> requires
- jEdit 4.2pre3 and ErrorListPlugin 1.1.</para>
- <itemizedlist>
- <listitem><para>Updated for jEdit 4.2 API changes.</para></listitem>
- <listitem><para>Added <function>getParseTriggers()</function> method
- to <classname>SideKickParser</classname> class.</para></listitem>
- <listitem><para>Added <function>getErrorSource()</function> method
- to <classname>SideKickPlugin</classname> class.</para></listitem>
- <listitem><para>Cleaned up and debugged completion code.</para></listitem>
- <listitem><para>Previously if the <guilabel>parse on keystroke</guilabel>
- option was on, an in-progress parse was not stopped. This resulted in poor
- performance. Now, an API has been added for stopping parsing (although only
- the XML plugin uses it at the moment). Combined with the position optimization
- in jEdit 4.2pre3, this should result in improved responsiveness when editing
- large XML files.</para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.2</emphasis> requires
- jEdit 4.1pre11 and ErrorListPlugin 1.0.</para>
- <itemizedlist>
- <listitem><para>Fixed a thread safety problem.
- </para></listitem>
- <listitem><para>Added <function>activate()</function> and
- <function>deactivate()</function> methods to
- <classname>SideKickParser</classname> class. These methods are called when
- a buffer using this parser is selected and deselected in a given view.
- </para></listitem>
- <listitem><para>The priority of the thread used by SideKick to parse files
- is now the minimum priority.
- </para></listitem>
- <listitem><para>jEdit keyboard shortcuts now work when invoked while a
- completion popup is open.
- </para></listitem>
- </itemizedlist>
- </listitem>
- <listitem><para><emphasis role="bold">Version 0.1</emphasis> requires
- jEdit 4.1pre11.</para>
- <itemizedlist>
- <listitem><para>Initial release.
- </para></listitem>
- </itemizedlist>
- </listitem>
- </itemizedlist>
- </appendix>
- </book>