PageRenderTime 199ms CodeModel.GetById 188ms app.highlight 6ms RepoModel.GetById 0ms app.codeStats 0ms

/jEdit/tags/jedit-4-0-pre5/doc/users-guide/macro-index.xml

#
XML | 416 lines | 354 code | 58 blank | 4 comment | 0 complexity | 2b96967a00e44eecf8230da8386a6b83 MD5 | raw file
  1<!-- jEdit 4.0 Macro Guide, (C) 2001 John Gellene      -->
  2
  3<!-- jEdit buffer-local properties:                    -->
  4<!-- :indentSize=1:noTabs=yes:maxLineLen=72:tabSize=2: -->
  5
  6<!-- covers index to installed macro set               -->
  7
  8<appendix id="macro-index"><title>Macros Included With jEdit</title>
  9
 10<para>
 11    jEdit comes with a large number of sample macros that perform a variety
 12    of tasks. The following index provides short descriptions of each macro,
 13    in some cases accompanied by usage notes.
 14</para>
 15
 16<para>
 17  Macros from earlier versions of jEdit can be found in the Downloads
 18  section of the <ulink url="http://community.jedit.org">jEdit
 19  Community</ulink> web site.
 20</para>
 21
 22<sect1 id="macros-files"><title>File Management Macros</title>
 23<para>
 24    These macros automate the opening and closing of files.
 25</para>
 26
 27<itemizedlist>
 28
 29<listitem>
 30    <para><filename>Browse_Directory.bsh</filename></para>
 31    <abstract><para>
 32        Opens a directory supplied by the user in the file system
 33        browser.
 34    </para></abstract>
 35</listitem>
 36
 37<listitem>
 38    <para><filename>Close_All_Except_Active.bsh</filename></para>
 39    <abstract><para>
 40        Closes all files except the current buffer.
 41    </para></abstract>
 42    <para>
 43        Prompts the user to save any buffer containing unsaved changes.
 44    </para>
 45</listitem>
 46
 47<listitem>
 48    <para><filename>Open_Path.bsh</filename></para>
 49    <abstract><para>
 50        Opens the file supplied by the user in an input dialog.
 51    </para></abstract>
 52</listitem>
 53
 54<listitem>
 55    <para><filename>Open_Selection.bsh</filename></para>
 56    <abstract><para>
 57        Opens the file named by the current buffer's selected text.
 58    </para></abstract>
 59</listitem>
 60
 61
 62</itemizedlist>
 63
 64</sect1>
 65
 66<sect1 id="macros-text"><title>Text Macros</title>
 67<para>
 68    These macros generate various forms of formatted text.
 69</para>
 70
 71<itemizedlist>
 72
 73<listitem>
 74    <para><filename>Add_Prefix_and_Suffix.bsh</filename></para>
 75    <abstract><para>
 76        Adds user-supplied <quote>prefix</quote> and <quote>suffix</quote>
 77        text to each line in a group of selected lines.
 78    </para></abstract>
 79    <para>
 80        Text is added after leading whitespace and before trailing whitespace.
 81        A dialog window receives input and <quote>remembers</quote> past entries.
 82    </para>
 83</listitem>
 84
 85<listitem>
 86    <para><filename>Color_Picker.bsh</filename></para>
 87    <abstract><para>
 88        Displays a color picker and inserts the selected color in
 89        hexadecimal format, prefixed with a <quote>#</quote>.
 90    </para></abstract>
 91</listitem>
 92
 93<listitem>
 94    <para><filename>Duplicate_Line.bsh</filename></para>
 95    <abstract><para>
 96        Duplicates the line on which the caret lies immediately
 97        beneath it and moves the caret to the new line.
 98    </para></abstract>
 99</listitem>
100
101<listitem>
102    <para><filename>Insert_Date.bsh</filename></para>
103    <abstract><para>
104        Inserts the current date and time in the current buffer.
105    </para></abstract>
106    <para>
107        The inserted text includes a representation of the time in the
108        <quote>Internet Time</quote> format.
109    </para>
110</listitem>
111
112<listitem>
113    <para><filename>Insert_Tag.bsh</filename></para>
114    <abstract><para>
115        Inserts a balanced pair of HTML/SGML/XML markup tags as supplied
116        in a input dialog.
117    </para></abstract>
118</listitem>
119
120<listitem>
121    <para><filename>Next_Char.bsh</filename></para>
122    <abstract><para>
123        Finds next occurence of character on current line.
124    </para></abstract>
125    <para>
126        The macro takes the next character typed after macro execution
127        as the character being searched.  That character is not
128        displayed.  If the character does not appear in the balance of
129        the current line, no action occurs.
130    </para>
131    <para>
132        This macro illustrates the use of
133        <function>InputHandler.readNextChar()</function> as a means of
134        obtaining user input. See <xref linkend="macro-tips-single-char"
135        />.
136    </para>
137</listitem>
138
139<listitem>
140  <para><filename>Toggle_Line_Comment.bsh</filename></para>
141  <abstract><para>
142	  Toggles line comments, alternately inserting and deleting them
143    at the beginning of each selected line.
144  </para></abstract>
145	<para>
146		If there is no selection, the macro operates on the current line.
147	</para>
148</listitem>
149
150<listitem>
151    <para><filename>Vertical_Paste.bsh</filename></para>
152    <abstract><para>
153		  Pastes the content of the clipboard vertically and fills empty
154      areas if necessary.
155    </para></abstract>
156</listitem>
157
158</itemizedlist>
159</sect1>
160
161<sect1 id="macros-java"><title>Java Code Macros</title>
162<para>
163    These macros handle text formatting and generation tasks that are
164    particularly useful in writing Java code.
165</para>
166
167<itemizedlist>
168
169<listitem>
170    <para><filename>Get_Class_Name.bsh</filename></para>
171    <abstract><para>
172        Inserts a Java class name based upon the buffer's file name.
173    </para></abstract>
174</listitem>
175
176<listitem>
177    <para><filename>Get_Package_Name.bsh</filename></para>
178    <abstract><para>
179        Inserts a plausible Java package name for the current buffer.
180    </para></abstract>
181    <para>
182        The macro compares the buffer's path name with the elements of the
183        classpath being used by the jEdit session.  An error message will be
184        displayed if no suitable package name is found. This macro will not
185        work if jEdit is being run as a JAR file without specifying a
186        classpath; in that case the classpath seen by the macro consists
187        solely of the JAR file.
188    </para>
189</listitem>
190
191<listitem>
192    <para><filename>Make_Get_and_Set_Methods.bsh</filename></para>
193    <abstract><para>
194        Creates <function>getXXX()</function> or <function>setXXX()</function>
195        methods that can be pasted into the buffer text.
196    </para></abstract>
197    <para>
198        This macro presents a dialog that will <quote>grab</quote> the names
199        of instance variables from the caret line of the current buffer
200        and paste a corresponding <function>getXXX()</function> or
201        <function>setXXX()</function> method to one of two text areas in the
202        dialog.  The text can be edited in the dialog and then pasted into the
203        current buffer using the <guilabel>Insert...</guilabel> buttons.  If
204        the caret is set to a line containing something other than an instance
205        variable, the text grabbing routine is likely to generate nonsense.
206    </para>
207    <para>
208        As explained in the notes accompanying the source code, the macro
209        uses a global variable which can be set to configure the macro to work
210        with either Java or C++ code.  When set for use with C++ code,
211        the macro will also write (in commented text) definitions of
212        <function>getXXX()</function> or <function>setXXX()</function>
213        suitable for inclusion in a header file.
214    </para>
215</listitem>
216
217<listitem>
218   <para><filename>Preview_Javadoc_of_Buffer.bsh</filename></para>
219   <abstract><para>
220     Creates and displays javadoc for current buffer.
221   </para></abstract>
222   <para>
223      The macro includes configuration variables for using
224      different doclets for generating javadocs and for genreating
225      javadocs of the package of which the current buffer is a part.
226      Details for use are included in the note accompanying the macro's
227      source code.
228   </para>
229</listitem>
230
231</itemizedlist>
232
233</sect1>
234
235<sect1 id="macros-properties"><title>Macros for Listing Properties</title>
236<para>
237    These macros produce lists or tables containing properties
238    used by the Java platform or jEdit itself.
239</para>
240
241
242<itemizedlist>
243
244<listitem>
245    <para><filename>jEdit_Properties.bsh</filename></para>
246    <abstract><para>
247       Writes an unsorted list of jEdit properties in a new buffer.
248    </para></abstract>
249</listitem>
250
251<listitem>
252    <para><filename>System_Properties.bsh</filename></para>
253    <abstract><para>
254        Writes an unsorted list of all Java system properties in a new
255        buffer.
256    </para></abstract>
257</listitem>
258
259<listitem>
260    <para><filename>Look_and_Feel_Properties.bsh</filename></para>
261    <abstract><para>
262        Writes an unsorted list of the names of Java Look and Feel
263        properties in a new buffer.
264    </para></abstract>
265</listitem>
266
267</itemizedlist>
268
269</sect1>
270
271<sect1 id="macros-misc"><title>Miscellaneous Macros</title>
272<para>
273    While these macros do not fit easily into the other categories, they all provide
274    interesting and useful functions.
275</para>
276
277<itemizedlist>
278
279<listitem>
280    <para><filename>Cascade_jEdit_Windows.bsh</filename></para>
281    <abstract><para>
282        Rearranges view and floating plugin windows.
283    </para></abstract>
284    <para>
285        The windows are arranged in an overlapping <quote>cascade</quote>
286        pattern beginning near the upper left corner of the display.
287    </para>
288</listitem>
289
290<listitem>
291    <para><filename>Display_Abbreviations.bsh</filename></para>
292    <abstract><para>
293        Displays the abbreviations registered for each of jEdit's
294        editing modes.
295    </para></abstract>
296    <para>
297        The macro provides a read-only view of the abbreviations
298        contained in the <quote>Abbreviations</quote> option pane.  Pressing
299        a letter key will scroll the table to the first entry beginning with
300        that letter.  A further option is provided to write a selected mode's
301        abbreviations or all abbreviations in a text buffer for printing as a
302        reference. Notes in the source code listing point out some display options
303        that are configured by modifying global variables.
304    </para>
305</listitem>
306
307<listitem>
308    <para><filename>Display_Shortcuts.bsh</filename></para>
309    <abstract><para>
310        Displays a sorted list of the keyboard shortcuts currently in effect.
311    </para></abstract>
312    <para>
313        The macro provides a combined read-only view of command, macro
314        and plugin shortcuts. Pressing a letter key will
315        scroll the table to the first entry beginning with that letter.
316        A further option is provided to write the shortcut assignments in a
317        text buffer for printing as a reference. Notes in the source code
318        listing point out some display options that are configured by
319        modifying global variables.
320    </para>
321</listitem>
322
323<listitem>
324    <para><filename>Evaluate_Buffer_in_BeanShell.bsh</filename></para>
325    <abstract><para>
326        Evaluates contents of current buffer as a BeanShell script,
327        and opens a new
328        buffer to receive any text output.
329    </para></abstract>
330    <para>
331        This is a quick way to test a macro script even before its text
332        is saved to a file.  Opening a new buffer for output is a precaution
333        to prevent the macro from inadvertently erasing or overwriting
334        itself.  BeanShell scripts that operate on the contents of the
335        current buffer will not work meaningfully when tested using this
336        macro.
337    </para>
338</listitem>
339
340<listitem>
341  <para><filename>Hex_Convert.bsh</filename></para>
342  <abstract><para>
343    Converts byte characters to their hex equivalent, and vice versa.
344  </para></abstract>
345</listitem>
346
347
348<listitem>
349    <para><filename>Include_Guard.bsh</filename></para>
350    <abstract><para>
351		Intended for C/C++ header files, this macro inserts a preprocessor
352		directive in the current buffer to ensure that the header is
353		included only once per compilation unit.
354    </para></abstract>
355    <para>
356        To use the macro, first place the caret at the beginning of the
357		header file before any uncommented text.  The macro will return to
358		this position upon completion.  The defined term that triggers the
359		<quote>include guard</quote> is taken from the buffer's name.
360    </para>
361</listitem>
362
363<listitem>
364    <para><filename>Make_Bug_Report.bsh</filename></para>
365    <abstract><para>
366      Creates a new buffer with installation and error information
367	    extracted from the activity log.
368    </para></abstract>
369	<para>
370	  The macro extracts initial messages written to the activity log
371	  describing the user's operating system, JDK, jEdit version and
372	  installed plugins. It then appends the last set of error messages
373	  written to the activity log.  The new text buffer can be saved and
374	  attached to an email message or a bug report made on SourceForge.
375	</para>
376</listitem>
377
378<listitem>
379  <para><filename>Run_Script.bsh</filename></para>
380  <abstract><para>
381    Runs script using interpreter based upon buffer's editing mode
382    (by default, determined using file extension).
383  </para></abstract>
384</listitem>
385
386<listitem>
387    <para><filename>Show_Threads.bsh</filename></para>
388    <abstract><para>
389      Displays all running Java threads in a tree.
390    </para></abstract>
391</listitem>
392
393<listitem>
394    <para><filename>Write_HyperSearch_Results.bsh</filename></para>
395    <abstract><para>
396        This macro writes the contents of the <quote>HyperSearch
397        Results</quote> window to a new text buffer.
398    </para></abstract>
399    <para>
400        The macro employs a simple text report format. Since
401        the HyperSearch window's object does not maintain the search
402        settings that produced the displayed results, the macro examines the
403        current settings in the <classname>SearchAndReplace</classname> object.
404        It confirms that the HyperSearch option is selected before writing
405        the report. However, the only way to be sure that the report's contents
406        are completely accurate is to run the macro immediately after a
407        HyperSearch.
408    </para>
409</listitem>
410
411</itemizedlist>
412
413</sect1>
414
415</appendix>
416