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.

ajdee.xml 15KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455
  1. <refentry id="ajdee">
  2. <refnamediv>
  3. <refname>AJDEE</refname>
  4. <refpurpose>JDEE support for XEmacs and GNU Emacs </refpurpose>
  5. </refnamediv>
  6. <refsect1>
  7. <title>AJDE for Emacs User's Guide</title>
  8. <para>
  9. This guide describes AspectJ-mode extensions of JDEE for GNU Emacs and
  10. XEmacs, which
  11. provides enhanced editing and management of AspectJ code via a minor
  12. mode extension of JDE mode. AJDEE's AspectJ support builds on
  13. <link linkend="aspectj-mode">aspectj-mode's</link> extension of
  14. java-mode, also provided with the release.
  15. Included in this document are guidance for AJDEE's <link
  16. linkend="ajdee-featuresandusage">use</link>, including an <link
  17. linkend="exploringspacewar">exploration of spacewar</link>, and <link
  18. linkend="ajdee-installationetc">installation and compatibility</link>. See
  19. the README file in AJDEE's distribution directory for
  20. release-specific details.
  21. </para>
  22. <para>
  23. In addition to the java-mode extensions provided by
  24. <link linkend="aspectj-mode">aspectj-mode</link>, AJDEE provides
  25. (see graphic):
  26. <itemizedlist>
  27. <listitem>
  28. <para>
  29. Viewing and navigation of aspect structures via the
  30. the speedbar and Classes menu.
  31. </para>
  32. </listitem>
  33. <listitem>
  34. <para>
  35. Basic support for completion.
  36. </para>
  37. </listitem>
  38. <listitem>
  39. <para>
  40. Integrated Javadoc support.
  41. </para>
  42. </listitem>
  43. </itemizedlist>
  44. </para>
  45. <para>
  46. <inlinemediaobject id="ajdeemacsscreenshot">
  47. <imageobject>
  48. <imagedata fileref="ajdee.gif"/>
  49. </imageobject>
  50. </inlinemediaobject>
  51. </para>
  52. </refsect1>
  53. <refsect1 id="ajdee-featuresandusage"><!-- Features and Usage -->
  54. <title>AJDEE Features and Usage</title>
  55. <para>
  56. The AJDEE extensions of JDE require no special effort to use.
  57. The speedbar and Classes menus provide additional sublists showing
  58. crosscutting structure. Selecting items in those lists navigates to
  59. the referenced item.
  60. </para>
  61. <refsect2>
  62. <title>Aspect Structure and Navigation</title>
  63. <refsect3>
  64. <title>Enhancements to Speedbar in JDE Mode</title>
  65. <para>
  66. As a minor mode of JDE mode, AJDEE enhances the speedbar to
  67. show the location of aspect, advice, and inter-type declarations.
  68. The affects/affected-by relationships are shown in the speedbar
  69. rather than embedding tags in the text (available as an option),
  70. and selecting the items in the speedbar will perform the expected
  71. navigation. The speedbar symbols have been extended for AspectJ as
  72. follows (see right side of <link
  73. linkend="ajdeemacsscreenshot">figure)</link>:
  74. </para>
  75. <table id="speedbarenhancements">
  76. <title>Enhancements to Speedbar in JDE Mode</title>
  77. <tgroup cols="2" colsep="1" rowsep="1" align="left">
  78. <thead>
  79. <row>
  80. <entry>Indication</entry>
  81. <entry>Meaning</entry>
  82. </row>
  83. </thead>
  84. <tbody>
  85. <row>
  86. <entry>
  87. <literal>(+) </literal>
  88. <emphasis><literal>name</literal></emphasis>
  89. </entry>
  90. <entry>
  91. A class, interface, or aspect; double mouse-1 will
  92. display its declarations
  93. </entry>
  94. </row>
  95. <row>
  96. <entry><literal>+ </literal>
  97. <emphasis><literal>methodSignature</literal></emphasis>
  98. </entry>
  99. <entry>
  100. Method has an advice that applies to it; double mouse-1
  101. will display the relevant advice.
  102. </entry>
  103. </row>
  104. <row>
  105. <entry><literal>+ </literal>
  106. <emphasis><literal>adviceSignature</literal></emphasis>
  107. </entry>
  108. <entry>
  109. Advice declared by the containing aspect; double mouse-1
  110. will display affected methods.
  111. </entry>
  112. </row>
  113. <row>
  114. <entry><literal>+ </literal>
  115. <emphasis><literal>introductionSig</literal></emphasis>
  116. </entry>
  117. <entry>
  118. Inter-type declaration declared by the containing class; double
  119. mouse-1 will display affected methods or classes.
  120. </entry>
  121. </row>
  122. <row>
  123. <entry><literal>| | </literal>
  124. <emphasis><literal>methodOrFieldSig</literal></emphasis>
  125. </entry>
  126. <entry>
  127. Method or field has been declared by an aspect;
  128. double mouse-1 on text will navigate to the declaration; a +
  129. within the bars means that it has an advice that applies
  130. to it.
  131. </entry>
  132. </row>
  133. </tbody>
  134. </tgroup>
  135. </table>
  136. <para>
  137. A minus (<literal>-</literal>) is displayed on the item when the
  138. crosscutting items are displayed. AspectJ structure information is
  139. derived from the last compile of your AspectJ program.
  140. </para>
  141. </refsect3>
  142. </refsect2>
  143. <refsect2>
  144. <title>Compilation and JavaDoc</title>
  145. <para>
  146. The option <option>AspectJ Compile File Specification</option>
  147. can be customized from the <guisubmenu>Customize options</guisubmenu>
  148. under the <guimenu>AspectJ</guimenu> menu, changing the default
  149. compile specification given to <command>ajc</command>.
  150. See <link linkend="ajdee-installationetc">installation instructions</link>
  151. for examples and other customizations.
  152. </para>
  153. <para>
  154. AspectJ JavaDoc support is
  155. enabled by setting <option>Jde Javadoc Command Path</option> to
  156. invoke <command>ajdoc</command>. These are the default settings
  157. provided in the installation instructions.
  158. </para>
  159. </refsect2>
  160. </refsect1>
  161. <refsect1 id="exploringspacewar"><!-- Exploring the Spacewar Source Code -->
  162. <title>Exploring the Spacewar Source Code</title>
  163. <para>
  164. To begin exploring Spacewar within emacs using JDE and AspectJ mode:
  165. </para>
  166. <itemizedlist>
  167. <listitem>
  168. <para>Compile spacewar.</para>
  169. </listitem>
  170. <listitem>
  171. <para>Change into the <filename>spacewar</filename>
  172. directory.</para>
  173. </listitem>
  174. <listitem>
  175. <para>Type <userinput>emacs Ship.java</userinput>.</para>
  176. </listitem>
  177. <listitem>
  178. <para>
  179. Pull down the <guimenu>JDE</guimenu> menu and select the
  180. <guimenuitem>Speedbar</guimenuitem> entry to show the AspectJ
  181. files in the directory. Note that <filename>Ship.java</filename>
  182. is shown in red to denote that it is currently shown in the main
  183. buffer.
  184. </para>
  185. </listitem>
  186. <listitem>
  187. <para>
  188. Double-click with the left mouse button on the
  189. <literal>+</literal> in front of the
  190. <filename>Ship.java</filename> entry. It should display an entry
  191. for the class <classname>Ship</classname>.
  192. </para>
  193. </listitem>
  194. <listitem>
  195. <para>
  196. Double-clicking on Ship will navigate to its declaration in
  197. the buffer. Note that declarations of advice are annotated to
  198. note the types of objects that they advise, declarations of
  199. methods that are advised are annotated with the aspects that
  200. advise them, and so forth.
  201. </para>
  202. </listitem>
  203. <listitem>
  204. <para>
  205. Double-clicking on the <literal>+</literal> in front of either
  206. will show the declared fields, methods, inter-type declarations, and
  207. advice. A <literal>+</literal> in front of any field or method
  208. means that it is introduced or advised; double-clicking will list
  209. entries for the introducers/advisers; double-clicking on them
  210. will navigate to their declarations. A <literal>+</literal> in
  211. front of any inter-type declarations or advice will will display its
  212. targets.
  213. </para>
  214. </listitem>
  215. </itemizedlist>
  216. </refsect1>
  217. <refsect1 id="ajdee-installationetc"><!-- Installation and Compatibility -->
  218. <title>Installation and Compatibility</title>
  219. <para> AJDEE requires the installation of
  220. <ulink url="http://sunsite.auc.dk/jde">JDE 2.2.9beta4</ulink> or
  221. higher and small edits to your <filename>.emacs</filename> file to
  222. configure AJDEE and enable autoloading AJDEE when a
  223. <filename>.java</filename> file is loaded.
  224. </para>
  225. <refsect2>
  226. <title>Installation for enhancement of JDE mode</title>
  227. <!-- <note> -->
  228. <para>
  229. The first and last steps, with enhancements, can be found in the
  230. example Emacs initialization file
  231. <filename>sample.emacs</filename> and the sample JDE project
  232. file <filename>sample.prj</filename> in the distribution. The
  233. latter also demonstrates a way to enable AspectJ mode on a
  234. per-project basis.
  235. </para>
  236. <!-- </note> -->
  237. <orderedlist>
  238. <listitem>
  239. <para>
  240. Make sure AJDEE, aspectj-mode, JDE, and supporting packages are on
  241. your <literal>load-path</literal> and are ``required''. This is an
  242. example for the 1.0 release:
  243. <programlisting>
  244. ;; I keep my emacs packages in C:/Emacs
  245. (setq load-path
  246. (append
  247. '(
  248. "C:/Emacs/aspectj-emacsMode-1.0" ; for AJDEE
  249. "C:/Emacs/aspectj-emacsAJDEE-1.0"
  250. "C:/Emacs/jde-2.2.9beta6/lisp"
  251. "C:/Emacs/elib-1.0" ; for JDEE
  252. "C:/Emacs/speedbar-0.14beta2" ; for JDEE
  253. "C:/Emacs/semantic-1.4beta12" ; for JDEE/speedbar
  254. "C:/Emacs/eieio-0.17beta3" ; for JDEE
  255. )
  256. load-path))
  257. (require 'jde)
  258. (require 'ajdee) ; can also appear in prj.el
  259. </programlisting>
  260. </para>
  261. </listitem>
  262. <listitem>
  263. <para>
  264. <emphasis>[Optional]</emphasis> add <literal>-emacssym</literal>
  265. switch to the <filename>ajc</filename> and <filename>ajc.bat</filename>
  266. files in your AspectJ tools installations (in the
  267. <filename>/bin</filename> directory). If you invoke the compiler
  268. outside Emacs, this will
  269. ensure that your compiles always generate information for annotations
  270. and the jump menu in the form of <literal>.ajesym</literal> files.
  271. </para>
  272. </listitem>
  273. <listitem>
  274. <para>
  275. Customize AJDEE's compile options by
  276. putting a version of the following in your
  277. <filename>.emacs</filename> file or in a JDE project file
  278. <filename>prj.el</filename> in your project's hierarchy (see the
  279. <option>JDE Project File Name</option> option for the latter).
  280. Here is a simple example:
  281. <programlisting>
  282. ;; A default version for simple projects, maybe good for
  283. ;;; .emacs file.
  284. (custom-set-variables
  285. '(jde-compiler '("ajc" "ajc"))
  286. '(jde-javadoc-command-path "ajdoc")
  287. ;; ajc requires all files to be named for a compile
  288. '(aspectj-compile-file-specification "*.java"))
  289. </programlisting>
  290. Here is an example for spacewar, in
  291. <filename>examples/spacewar</filename>.
  292. <programlisting>
  293. ;;; These options are for the spacewar, in examples/spacewar.
  294. (custom-set-variables
  295. '(jde-compiler '("ajc" "ajc"))
  296. '(jde-javadoc-command-path "ajdoc")
  297. ;; ajc provides an ``argfile'' mechanism for specifying all files.
  298. '(aspectj-compile-file-specification "-argfile demo.lst")
  299. ;; *if* compiling packages, name root dir for package hierarchy
  300. ;; to tell ajc where .class files should go.
  301. '(jde-compile-option-directory "..")
  302. '(jde-run-working-directory ".."))
  303. '(jde-run-application-class "spacewar.Game")
  304. </programlisting>
  305. </para>
  306. </listitem>
  307. <listitem>
  308. <para>
  309. <emphasis>[XEmacs only]</emphasis> If you're installing JDE
  310. yourself, be sure to closely follow the JDE installation
  311. directions for XEmacs, otherwise you may get out of date JDE
  312. <filename>.jar</filename> files.
  313. </para>
  314. </listitem>
  315. </orderedlist>
  316. </refsect2>
  317. <refsect2>
  318. <title>Customizing Options</title>
  319. <para>
  320. Selecting <guimenuitem>Customize options</guimenuitem> from the
  321. <guimenu>AspectJ</guimenu> menu displays a number of options that
  322. customize AspectJ mode. These control whether annotations are shown
  323. by default, and whether the bovinator set up by JDE runs.
  324. <option>AspectJ Compile File Specification</option>, specifies a
  325. compilation argument as
  326. an alternative to the current buffer's file or the run class's file.
  327. Example customizations are shown above and in the sample files
  328. discussed above.
  329. </para>
  330. </refsect2>
  331. </refsect1>
  332. <refsect1>
  333. <title>Usage and Upgrade Problems</title>
  334. Please see the documentation for
  335. <link linkend="aspectj-mode">aspectj-mode</link> for problems not
  336. specific to AJDEE's features.
  337. <itemizedlist>
  338. <listitem>
  339. <para><emphasis>Symptom</emphasis>: Get
  340. standard speedbar menus in JDE; no annotations display. Message:
  341. <screen>
  342. AspectJ Mode Warning: Can't find declarations file for...
  343. </screen>
  344. </para>
  345. <para>AspectJ file has not been compiled with ajc and the <literal>-emacssym</literal>
  346. flag,
  347. or was compiled with an obsolete version of ajc. After compilation,
  348. there should be a &lt;file&gt;.ajesym for every &lt;file&gt;.java in the
  349. build. If .ajsym files are present but error persists, recompile. Note
  350. that aspectj-mode for JDE has a fallback view for uncompiled files.
  351. </para>
  352. </listitem>
  353. <listitem>
  354. <para><emphasis>Symptom</emphasis>: Navigations via the speedbar and
  355. the jump menu are off, annotations are misplaced in the code. </para>
  356. <para>AspectJ mode operates by querying data
  357. derived from the most recent compile that includes the
  358. <literal>-emacssym</literal> flag. Recompile the entire program with
  359. ajc including the switch. Consider permanently installing the switch
  360. by editing the ajc and ajc.bat files in the /bin file in your
  361. distribution.</para>
  362. </listitem>
  363. <listitem>
  364. <para><emphasis>Symptom</emphasis>: Java files that are part of a Java project not written
  365. in AspectJ come up in aspectj-mode. </para>
  366. <para>Emacs uses the file suffix (.java) to
  367. determine which mode to invoke. You can either globally toggle the
  368. AspectJ features from the AspectJ menu, or you can prevent AJDEE
  369. from coming up by moving the (require 'ajdee) expression from
  370. your .emacs file to a prj.el file in each AspectJ project's directory
  371. (see sample.prj in the distribution).
  372. </para>
  373. </listitem>
  374. <listitem>
  375. <para><emphasis>Symptom</emphasis>: Reported bug fixes and new features
  376. to AJDEE are not seen, or ajdee.el cannot be found or loaded, with
  377. message:
  378. <screen>
  379. Error in init file: File error: "Cannot open load file", "ajdee"
  380. </screen>
  381. </para>
  382. <para>Your load-path variable (set in your .emacs)
  383. is referring to an old release. Change your load-path to
  384. point at the directory for the current release. See the sample.emacs
  385. files in the distribution, for example.</para>
  386. </listitem>
  387. </itemizedlist>
  388. </refsect1>
  389. </refentry>
  390. <!-- Local variables: -->
  391. <!-- fill-column: 79 -->
  392. <!-- compile-command: "ant -quiet dev-html" -->
  393. <!-- sgml-local-ecat-files: devguide.ced -->
  394. <!-- sgml-parent-document:("devguide.sgml" "book" "refentry") -->
  395. <!-- End: -->