AspectJ Development Environment Support for Borland JBuilder

Name

AspectJ Development Environment Support for Borland JBuilder — provide support for AspectJ in Borland's JBuilder integrated development environment

Overview

AspectJ Development Environment (AJDE) support for JBuilder is an extension to Borland's JBuilder. It 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

Current Release

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.

Installation

  • Use the installer to place the "ajdeForJBuilder.jar" and "aspectjrt.jar" in to JBuilder's lib/ext directory.

Key Improvements

  • The "AspectJ Structure View" replaces JBuilder's structure view instead of being launched in a separate window.

  • 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.

  • Projects no longer require the manual adding of the "aspectjrt.jar" libarary.

Key Concepts

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

  • By default every file accessible in the project will be compiled. To use ".lst" configuration files add them to your project and the structure window will let you select the file that you want to compile.

Known Bugs & Limitations

  • 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.

IDE Window and AspectJ Structure View

The following figure demonstrates a typical view of AspectJ Support for JBuilder running:

  1. The AspectJ Support for JBuilder buttons

  2. The "AJ" button opens the Structure View

  3. This button launches the AspectJ Support for AspectJ Console

  4. The "compile with ajc" button

  5. The "run" button

  6. The Structure View showing the structure for the currently selected class

  7. The Structure View displays the structure of the AspectJ program; here we see that the "static around(Ship)" advice action affects 4 different methods on the "Ship" class. To navigate to these methods simply double click their entries in the tree.

  8. The structure view navigation and auto-arrange buttons

  9. Since navigating the Structure View can cause you to jump between files internet browser style "forward" and "back" buttons are provided

  10. The auto-arrange button will tile the JBuilder window with the Structure View window

AspectJ Console (JBuilder 3.5)

  1. Configuration tab

  2. This pane allows you to select the files that will be passed to the compiler

  3. Messages tab

  4. This pane displays the compile command passed to ajc as well as the corresponding output

  5. "Debug.java" removed from the files passed to ajc

  6. the "Debug.java" has been removed from the current configuration. Once "OK" is clicked that file will no longer be passed to the compiler.

Setting up, Compiling, and Running Spacewar in JBuilder 4

To set up the examples/spacewar example (available for download at the bottom of the Download Page) you can use the following steps as a guideline, or use the "New AJDE Project..." Wizard.

Step 1: set up Spacewar as a JBuilder project

  • Launch JBuilder 4

  • In the "File" menu select "New Project..."

  • Fill out the fields according to the following screenshot and then click "Next >"

Step 2: adding "aspectjrt.jar" as a project library

  • In the "Project wizard - Step 2 of 3" window under "Required Libraries" select "Add".

  • When the "Select One or More Libraries" dialog comes up click "New...".

  • In the "New Library Wizard" create the "AspectJ Runtime" library using your corresponding "jbuilder4/lib/ext/aspectjrt.jar" path by clicking the "Add" button.

  • Click "OK" out of both dialog boxes, and then click "Finish":

Step 3: adding sources to your project

  • In the "Project Explorer (left and uppermost pane in the IDE) right click on "Spacewar.jpr" and select "Add Files / Packages...".

  • Click the "Packages" tab.

  • Select both "spacewar" and "coordination" by cntrl-clicking them and click "OK".

Step 4: setting up the build configuration and compiling

  • AJDE currently only supports one build configuration is taken from a file called "Default.lst" in your project's root directory. If you try to compile without this file AJDE will create it for you and you can modify it accordingly.

Step 5: running the Spacewar example
  • Before running please see the Note for java.awt Users.

  • When the compile finishes, click "AspectJ Run" in the "Tools" menu.

  • If you have not selected a class to run, you will be prompted to do so: click "OK" in the prompt dialog.

  • In the "Project Properties" dialog that pops up select the "Run" tab.

  • In the "Main class: " selection click "..."

  • open up the "spacewar" package, select "Game" and click "OK".

  • Click "AspectJ Run" again to run Spacewar.

Setting up, Compiling, and Running in JBuilder 3.5

To set up the examples/spacewar example (available for download at the bottom of the Download Page) you can use the following steps as a guideline:

  1. launch JBuilder 3.5

  2. in the "File" menu select "New project"

  3. click "Browse" and locate the "aspectj/examples" directory

  4. type "Spacewar.jpr" into the dialog box to save the project file in that directory (note, since the Spacewar example uses both the "spacewar" and "coordination" packages the project is set up in the root examples directory) and click "Save" to close the "New Project File" dialog box

  5. click "Finish"

  6. in the "Project" menu select "Project properties..."

  7. set the "Output path" entry to be the directory where you want your classes to go

  8. in the "Source" tab select the entry and click "Edit" (by default JBuilder will set this directory to be "examples/src" which does not exist)

  9. once the "Select a path" dialog appears simply click "OK" since this will select the "examples" directory

  10. click "OK" to close the "Project Properties" dialog

  11. in the leftmost pane you will notice "Spacewar.jpr", right click this and select "Add to project" in the popup, then "Add class/package..." in the next popup

  12. <cntrl> click "spacewar" and "coordination" and then click "OK"; this will add the two packages to your project

  13. open the AspectJ Support for JBuilder Console

  14. you can remove "Debug.java" (this aspect adds considerable overhead to the compile) by clicking it, then click "OK" to save the build configuration and close the console

  15. click the "Compile" button to compile the project

  16. open the Structure View to browse the structure of the program

  17. click the "Run" button to play Spacewar

  18. if you have not selected a class to run, you will be prompted to do so: click "OK" in the prompt dialog, then

  19. in the "Project Properties" dialog that pops up select the "Run" tab

  20. under "Application" click "Set..."

  21. open up the "spacewar" package, select "Game" and click "OK"