AspectJ Development Environment Support for Forte for Java

Name

AspectJ Development Environment Support for Forte for Java — provide support for AspectJ in Sun's Forte integrated development environment

Overview

AspectJ Support for Forte is an extension to Sun Microsystem's Forte for Java.  AJDE for Forte will allow you to

  • compile AspectJ and Java files within the IDE

  • set up a compile configuration that determine which files will be passed to the compiler

  • browse the structure of your AspectJ program

The AspectJ Development environment has been rewritten for AspectJ 1.0 alpha 1.  This documentation is targeted at the 0.8beta4 release but much of it still applies to the current release.

Current Release

Installation

  • Use the installer to place the "ajdeForForte.jar" in Forte's modules directory  and "aspectjrt.jar" in to Forte's lib/ext directory.

  • In the "Tools" menu select "Global Options"

  • Right-click the "Modules" item and select "New Module from File..."

  • Find the ajdeForForte.jar in the directory that you installed into (e.g. c:\forte4j\modules) and select it.

Key Improvements

  • AJDE can be toggled on/off with the "AJ" button--when it is turned off all of the menus, resources, and event listeners that it uses will be removed.

  • The AJDE functionality is now contained within it's own toolbar and menu.

Key Concepts

  • AJDE support can be toggled on and off by means of the "AJ" button.

  • For working with AspectJ code use only the AspectJ toolbar and the "AspectJ Structure" explorer, along with the filesystem explorer--do not use the regular compile/debug/execute buttons.

  • You must mount a filesystem whose path ends with "ajworkingdir" and will be warned to do so if you don't.  This is where ajc will put it's generated source and output class files.

Known Bugs & Limitations

  • "Mode" switching is not supported in this version--you must do all of your AspectJ work in the "Editing" mode.  If you switch modes the IDE has to be restarted for the AspectJ window to show again.

  • There is no compiler progress dialog--the way to tell if the compile is finished is to watch the "status" area of the main window.

  • There are no keyboard compile/execute shortcuts.

  • The structure view is not persistent between IDE launches--you must compile to view the structure for a program.

  • The debugger has not seen much use and it's stability and performance is limited.

  • There is no ajdoc tool support.

  • Linux testing has been very limited.

Documentation for 0.8beta4

Install Procedure

If you have not already done so, start by installing Forte4J from http://www.sun.com/forte/ffj, and start Forte4J.

2.1 Add the ajdeForForte module

  • in the "Tools" menu select "Global Options"

  • right-click the "Modules" item and select "New Module from File..."

  • find the ajdeForForte.jar in the directory that you installed into (e.g. c:\forte4j\modules) and select it

You are now ready to start using AJDE for Forte.  Refer to section 3 for instructions.

2.2 OPTIONAL: Set up ajc as an external compiler

The following procedure is not necessary to use AJDE for Forte.  You do not need to do the following steps unless you want to use ajc as one of Forte's external compilers (not recommended unless you know what you are doing and are aware of the performance overhead).  Refer to the next section about the standard way to compile AspectJ files. 

  • open an AspectJ project in Forte 

  • in the "Project" menu select "Settings"

  • open the "Compiler Types" item 

  • right-click the nested "External Compilation" item and select "New External Compilation Service" (the new item will appear as a child node of the "External Compilation" node)

  • click on the newly created service and in the right (properties) pane make the following changes:

  • "External Compiler" -> c:{/}apps{/}aspectj0.7{/}bin{/}ajc.bat -d c:{/}apps{/}aspectj0.7{/}examples -classpath {filesystems}{:}{classpath} {files}

  • Identifying Name -> AJC

  • Error Expression -> make a new one by clicking "..." and adding a new "Preset" called "AJC" with the following entries

  • Error expression: ^([^ ][^]+):([^][^]+):([0-9]+): (.*)

  • File Position: 1

  • Line Position: 2

  • Column Position: 3

  • Message Position: 4

  • click on the "Java Sources" item in the same "Project Settings" window and change the "Default Compiler" to "AJC"

To uninstall follow Forte's documentation on un-installing modules (process is similar to 2.2).

Running AJDE for Forte

3.1 Setting up the AspectJ Examples

  • in the "Project" menu select "New Project..."

  • enter "AspectJ Examples" as the projects' name and click "OK"

  • click "New" when prompted about the filesystems to use

  • browse into the AspectJ install directory (e.g. "C:\apps\aspectj0.7")

  • select "examples" and click "Mount"

  • in the "Explorer" window right-click "Project AspectJ Examples" and select "Add Existing..."

  • from the "examples" file system select all of the directories (by shift-clicking the top and bottom most" and click "OK"

  • click the "AJ" button (or in the "View" menu select "AspectJ Structure View"

  • In the "Explorer" window you can now select the "AspectJ Structure" tab and navigate the structure of the examples

  • You should also add a filesystem whose leaf directory is called "ajworkindir"--this is where the preprocessed files and output classes will be placed

3.2 Compiling the Spacewar Example

  • in the "AspectJ Structure" tab of the Project Explorer select "spacewar/default.lst" to compile that build configuration

  • in the "Build" menu select "Compile with ajc"

3.3 Running the Spacewar Example

  • in the "Filesystems" tab of the "Project Explorer" and open up the "ajworkingdir" filesystem

  • open up the "spacewar" package

  • scroll down to the "Game" class, right click it, and select "Execute"