You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

aspectj-mode.xml 12KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354
  1. <refentry id="aspectj-mode">
  2. <refnamediv>
  3. <refname>AspectJ-mode</refname>
  4. <refpurpose>support for XEmacs and GNU Emacs
  5. </refpurpose>
  6. </refnamediv>
  7. <refsect1>
  8. <title>AspectJ-mode User's Guide</title>
  9. <para>
  10. This guide describes aspectj-mode for GNU Emacs and XEmacs, which
  11. provides enhanced editing and management of AspectJ code via a minor
  12. mode extension of java-mode. Included in this document
  13. are guidance for aspectj-mode's <link
  14. linkend="ajmode-featuresandusage">use</link>, and
  15. <link linkend="ajmode-installationetc">installation and compatibility</link>.
  16. See the README file in the aspectj-mode's distribution directory for
  17. release-specific details.
  18. </para>
  19. <para>
  20. AspectJ minor mode provides (see graphic):
  21. <itemizedlist>
  22. <listitem>
  23. <para>
  24. Viewing and navigation of aspect structures, permitting
  25. navigation between aspect code and the code that it affects, via
  26. a `jump' menu (and in the speedbar and Classes menu for JDE
  27. users).
  28. </para>
  29. </listitem>
  30. <listitem>
  31. <para>
  32. Source code annotation of inter-type and advice declarations,
  33. as well as the code they affect.
  34. </para>
  35. </listitem>
  36. <listitem>
  37. <para>
  38. AspectJ-style compilation, using .lst files to generate a
  39. compilation submenu.
  40. </para>
  41. </listitem>
  42. <listitem>
  43. <para>
  44. Highlighting of AspectJ keywords and declaration names.
  45. </para>
  46. </listitem>
  47. </itemizedlist>
  48. </para>
  49. <para>
  50. The first two are derived from ajc's last build of the AspectJ program.
  51. An example usage is given below.
  52. </para>
  53. <para>
  54. <inlinemediaobject id="aspectjmodescreenshot">
  55. <imageobject>
  56. <imagedata fileref="aspectj-mode.gif"/>
  57. </imageobject>
  58. </inlinemediaobject>
  59. </para>
  60. </refsect1>
  61. <refsect1 id="ajmode-featuresandusage"><!-- Features and Usage -->
  62. <title>Features and Usage</title>
  63. <para>
  64. All commands governing AspectJ mode are available from the AspectJ menu
  65. on the toolbar. Besides those described below, there is a menu item
  66. <guimenuitem>Customize options</guimenuitem> for viewing and customizing
  67. the options of the mode and <guimenuitem>AJ Mode user guide</guimenuitem>
  68. to view this file. Keyword and declaration highlighting is enabled above
  69. the minimal level of highlighting.
  70. </para>
  71. <para>
  72. By default, AspectJ mode is automatically turned on when a buffer
  73. named with a <filename>.java</filename> suffix is entered.
  74. The command
  75. <command>M-x aspectj-mode-in-force-toggle</command> globally toggles
  76. the features of the mode, easing quickly moving between
  77. AspectJ and Java projects (also available as <guimenuitem>AspectJ mode
  78. extensions</guimenuitem> in the AspectJ menu).
  79. </para>
  80. <refsect2>
  81. <title>Aspect Structure and Navigation</title>
  82. <para>
  83. AspectJ minor mode highlights aspect relationships in the text with
  84. textual annotations on the program source (optionally can be turned
  85. off), such as the <literal>[Player, Robot, Ship]</literal> marking after the advice in EnsureShipIsAlive
  86. at the bottom of the <link linkend="aspectjmodescreenshot">figure</link>,
  87. which indicates that the advice refers to join points within Ship
  88. objects. The following commands (also available from the menu) manage
  89. annotations and navigation:
  90. </para>
  91. <table id="minormodecommands">
  92. <title>
  93. AspectJ Minor Mode Commands for Annotations and Navigation
  94. </title>
  95. <tgroup cols="2" colsep="1" rowsep="1" align="left">
  96. <thead>
  97. <row>
  98. <entry>Command (keyboard shortcut)</entry>
  99. <entry>Description</entry>
  100. </row>
  101. </thead>
  102. <tbody>
  103. <row>
  104. <entry>M-x aspectj-jump-menu (C-x C-j)</entry>
  105. <entry>
  106. Display popup menu of advisers, advisees, and inter-type declarations.
  107. Navigate to item by selecting with mouse
  108. (see <link linkend="aspectjmodescreenshot2">figure</link> below).
  109. </entry>
  110. </row>
  111. <row>
  112. <entry>M-x aspectj-show-annotations</entry>
  113. <entry>
  114. Add crosscut annotations on the text on current buffer.
  115. </entry>
  116. </row>
  117. <row>
  118. <entry>M-x aspectj-dont-show-annotations</entry>
  119. <entry>
  120. Remove crosscut annotations from text on current buffer.
  121. </entry>
  122. </row>
  123. </tbody>
  124. </tgroup>
  125. </table>
  126. <para>
  127. The default for whether annotations are shown or not can be
  128. customized by selecting <guimenuitem>Customize options</guimenuitem>
  129. from the <guimenu>AspectJ</guimenu> menu.
  130. </para>
  131. <para>
  132. <inlinemediaobject id="aspectjmodescreenshot2">
  133. <imageobject>
  134. <imagedata fileref="aspectj-mode2.gif"/>
  135. </imageobject>
  136. </inlinemediaobject>
  137. </para>
  138. </refsect2>
  139. <refsect2>
  140. <title>Compilation</title>
  141. <para>
  142. The <guisubmenu>Compile</guisubmenu> submenu
  143. accessible from the <guimenu>AspectJ</guimenu> menu presents the
  144. known<filename> .lst</filename> files for the project. Selecting
  145. one compiles the project with that <filename>.lst</filename> file
  146. and remembers that for future compiles. The
  147. <guimenuitem>Compile...</guimenuitem> command accessible from the
  148. Emacs <guimenu>Tools</guimenu> menu is customized through the
  149. project customization option <option>Aspectj Tools Compile
  150. Command</option>, customizable from the
  151. <guimenu>AspectJ</guimenu> menu.
  152. </para>
  153. </refsect2>
  154. </refsect1>
  155. <refsect1 id="ajmode-installationetc"><!-- Installation and Compatibility -->
  156. <title>Installation and Compatibility</title>
  157. <para> AspectJ mode requires the installation of <ulink
  158. url="http://www.gnu.org/software/emacs/">GNU Emacs 20.3.1</ulink>
  159. or <ulink url="http://www.xemacs.org/">XEmacs 21.1.14 (Unix/Linux)</ulink>,
  160. or <ulink url="http://www.xemacs.org/">XEmacs 21.4 (Windows)</ulink>,
  161. or higher. In general, the most recent non-alpha/beta versions of these
  162. are recommended. A web browser is required to view this documentation
  163. via Emacs. Small modifications to the <filename>.emacs</filename> file
  164. configures AspectJ mode and enables autoloading AspectJ mode when a
  165. <filename>.java</filename> file is loaded.
  166. </para>
  167. <refsect2>
  168. <title>
  169. Installation
  170. </title>
  171. <!-- <note> -->
  172. <para>
  173. Step 1, with enhancements, can be found in the example Emacs
  174. initialization file <filename>sample.emacs</filename> in the
  175. distribution.
  176. </para>
  177. <!-- </note> -->
  178. <orderedlist>
  179. <listitem>
  180. <para>
  181. The files in this package need to be in the load-path and
  182. ``required''. For example, for the 1.0 release:
  183. <programlisting>
  184. ;; I keep my emacs packages in C:/Emacs
  185. (setq load-path (cons "C:/Emacs/aspectj-emacsMode-1.0" load-path))
  186. (require 'aspectj-mode)</programlisting>
  187. </para>
  188. </listitem>
  189. <listitem>
  190. <para>
  191. <emphasis>[Optional]</emphasis> add <literal>-emacssym</literal>
  192. switch to the <filename>ajc</filename> and <filename>ajc.bat</filename>
  193. files in your AspectJ tools installations (in the
  194. <filename>/bin</filename> directory). If you invoke the compiler
  195. outside Emacs, this will
  196. ensure that your compiles always generate information for annotations
  197. and the jump menu in the form of <literal>.ajesym</literal> files.
  198. </para>
  199. </listitem>
  200. <listitem>
  201. <para>
  202. <!-- TBD: Change to something less bogus. -->
  203. <emphasis>[XEmacs only]</emphasis> Go to the
  204. <filename>xemacs-packages/lisp</filename> directory of your
  205. XEmacs distribution and move the <filename>jde</filename>
  206. directory to someplace harmless. Otherwise, Java files will come
  207. up in JDE mode.
  208. </para>
  209. </listitem>
  210. </orderedlist>
  211. </refsect2>
  212. <refsect2>
  213. <title>Customizing Options</title>
  214. <para>
  215. Selecting <guimenuitem>Customize options</guimenuitem> from the
  216. <guimenu>AspectJ</guimenu> menu displays a number of options that
  217. customize AspectJ mode. These control whether annotations are shown
  218. by default, as well as a
  219. number of options controlling compilation and beanshell for
  220. java-mode.
  221. Example customizations are given in the file
  222. <filename>sample.emacs</filename> in the distribution.
  223. </para>
  224. </refsect2>
  225. </refsect1>
  226. <refsect1>
  227. <title>Usage and Upgrade Problems</title>
  228. <itemizedlist>
  229. <listitem>
  230. <para><emphasis>Symptom</emphasis>: No annotations show. Message:
  231. <screen>
  232. AspectJ Mode Warning: Can't find declarations file for...
  233. </screen>
  234. </para>
  235. <para>AspectJ file has not been compiled with ajc and the <literal>-emacssym</literal>
  236. flag,
  237. or was compiled with an obsolete version of ajc. After compilation,
  238. there should be a &lt;file&gt;.ajesym for every &lt;file&gt;.java in the
  239. build. If .ajsym files are present but error persists, recompile. Note
  240. that aspectj-mode for JDE has a fallback view for uncompiled files.
  241. </para>
  242. </listitem>
  243. <listitem>
  244. <para><emphasis>Symptom</emphasis>: Annotations are misplaced in the
  245. code. </para>
  246. <para>AspectJ mode operates by querying data
  247. derived from the most recent compile that includes the
  248. <literal>-emacssym</literal> flag. Recompile the entire program with
  249. ajc including the switch. Consider permanently installing the switch
  250. by editing the ajc and ajc.bat files in the /bin file in your
  251. distribution.</para>
  252. </listitem>
  253. <listitem>
  254. <para><emphasis>Symptom</emphasis>: New customization option settings were saved
  255. for future sessions, but do not show up when Emacs is restarted.
  256. </para>
  257. <para>You may have two sets of saved settings in
  258. your .emacs file, and Emacs updated the first one, which may be shadowed
  259. by the second.</para>
  260. </listitem>
  261. <listitem>
  262. <para><emphasis>Symptom</emphasis>: Java files that are part of a Java project not written
  263. in AspectJ come up in aspectj-mode. </para>
  264. <para>Emacs uses the file suffix (.java) to
  265. determine which mode to invoke. You can either globally toggle the
  266. AspectJ features from the AspectJ menu.
  267. </para>
  268. </listitem>
  269. <listitem>
  270. <para><emphasis>Symptom</emphasis>: Reported bug fixes and new features
  271. to aspectj-mode are not seen, or aspectj-mode.el cannot be found or
  272. loaded, with message:
  273. <screen>
  274. Error in init file: File error: "Cannot open load file", "aspectj-mode"
  275. </screen>
  276. </para>
  277. <para>Your load-path variable (set in your .emacs)
  278. is referring to an old release. Change your load-path to
  279. point at the directory for the current release. See the sample.emacs
  280. files in the distribution, for example.</para>
  281. </listitem>
  282. <listitem>
  283. <para><emphasis>Symptom</emphasis>: When trying to get a jump menu,
  284. I get the message "No crosscut elements at point" even though
  285. there is a [list] on the same line.
  286. </para>
  287. <para>The caret (point) is probably on or after the list.
  288. To see the crosscut elements you need to hit the jump menu
  289. on the same line that the annotated elements appear as a list
  290. of items surrounded by '[' and ']' on the same line as the
  291. affected declaration. If the caret is on the same line as the
  292. elements and before the list (i.e. not at the end of the
  293. list of elements) the jump menu should work.
  294. </para>
  295. </listitem>
  296. </itemizedlist>
  297. </refsect1>
  298. </refentry>
  299. <!-- Local variables: -->
  300. <!-- fill-column: 79 -->
  301. <!-- compile-command: "ant -quiet dev-html" -->
  302. <!-- sgml-local-ecat-files: devguide.ced -->
  303. <!-- sgml-parent-document:("devguide.sgml" "book" "refentry") -->
  304. <!-- End: -->