PageRenderTime 42ms CodeModel.GetById 15ms RepoModel.GetById 0ms app.codeStats 0ms

/www/tags/NOV_07_2009/htdocs/42docs/users-guide/dialog-macro-intro.html

#
HTML | 28 lines | 28 code | 0 blank | 0 comment | 0 complexity | b6f18ec0e6dbd862ea93816ab013ac64 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. <html><head><meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"><title>Use of the Macro</title><meta name="generator" content="DocBook XSL Stylesheets V1.65.1"><link rel="home" href="index.html" title="jEdit 4.2 User's Guide"><link rel="up" href="dialog-macro.html" title="Chapter 14. A Dialog-Based Macro"><link rel="previous" href="dialog-macro.html" title="Chapter 14. A Dialog-Based Macro"><link rel="next" href="add-prefix-and-suffix.html" title="Listing of the Macro"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Use of the Macro</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="dialog-macro.html">Prev</a> </td><th width="60%" align="center">Chapter 14. A Dialog-Based Macro</th><td width="20%" align="right"> <a accesskey="n" href="add-prefix-and-suffix.html">Next</a></td></tr></table><hr></div><div class="sect1" lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a name="dialog-macro-intro"></a>Use of the Macro</h2></div></div><div></div></div><p>
  2. Our new example adds prefix and suffix text to a series of selected lines. This
  3. macro can be used to reduce typing for a series of text items that must be
  4. preceded and following by identical text. In Java, for example, if we are
  5. interested in making a series of calls to
  6. <tt class="function">StringBuffer.append()</tt> to construct a lengthy, formatted
  7. string, we could type the parameter for each call on successive lines as follows:
  8. </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">profileString_1
  9. secretThing.toString()
  10. name
  11. address
  12. addressSupp
  13. city
  14. &#8220;<span class="quote">state/province</span>&#8221;
  15. country</pre></td></tr></table><p>
  16. Our macro would ask for input for the common &#8220;<span class="quote">prefix</span>&#8221; and
  17. &#8220;<span class="quote">suffix</span>&#8221; to be applied to each line; in this case, the prefix is
  18. <b class="userinput"><tt>ourStringBuffer.append(</tt></b> and the suffix is
  19. <b class="userinput"><tt>);</tt></b>. After selecting these lines and
  20. running the macro, the resulting text would look like this:
  21. </p><table border="0" bgcolor="#E0E0E0"><tr><td><pre class="screen">ourStringBuffer.append(profileString_1);
  22. ourStringBuffer.append(secretThing.toString());
  23. ourStringBuffer.append(name);
  24. ourStringBuffer.append(address);
  25. ourStringBuffer.append(addressSupp);
  26. ourStringBuffer.append(city);
  27. ourStringBuffer.append(&#8220;<span class="quote">state/province</span>&#8221;);
  28. ourStringBuffer.append(country);</pre></td></tr></table></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="dialog-macro.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="dialog-macro.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="add-prefix-and-suffix.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Chapter 14. A Dialog-Based Macro </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Listing of the Macro</td></tr></table></div></body></html>