aboutsummaryrefslogtreecommitdiffstats
path: root/docs/devGuideDB/ajdejbuilder.adoc
blob: facfc766fcde21a98bd4ef7139f8a7cd9d468443 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
r

AspectJ Development Environment (AJDE) support for JBuilder

OpenTool extension Borland's

JBuilder IDE

.

== Overview

For release-specific documentation refer to the
http://aspectj.org/doc/dist/changes.html[changes file].

AJDE for JBuilder will allow you to:

* compile AspectJ and Java files within the IDE
* browse the structure of your AspectJ program
* set up a compile configuration that determine which files will be
passed to the compiler

== Installation and Project Setup

`Install procedure:` use the installer to place the
"ajdeForJBuilder.jar" and "aspectjrt.jar" into JBuilder's lib/ext
directory. This will also install the two html files
"LICENCE-AJDEJBUILDER.html" and "README-AJDEJBUILDER.html".

`Uninstall procedure:` remove "ajdeForJBuilder.jar" and "aspectjrt.jar"
(and the two html files, if you like) from the "lib/ext" directory.

`Project setup:` follow the normal procedure for JBuilder project setup
(for an example of this please refer to the example below). However,
note that all of the source files to be passed to the compiler must be
added to your project either as files or within a package that is added
to the project. This is necessary because -- unlike a pure Java compiler
-- ajc does not search the SOURCEPATH for classes.

`Starting and stopping AJDE:` select "Start AJDE" in the "AspectJ"
section of the "Tools" menu, or just click on the "AJDE"
(image:startAjde.gif[image]) button (label 1 in the first screenshot).
This will enable AJDE commands and will replace JBuilder's structure
view with the AspectJ Browser. To disable AJDE select "Stop AJDE" in the
same menu, or click the "AJDE" button again.

== Compiling and Running the Project

To compile the project select "Build project with ajc" from the AspectJ
toolbar, or click <ctrl>F11 while the editor pane is active. All of the
files contained in your project and within any packages and subpackages
that have been added to your project will be compiled. You may also
select a different configuration (as with label 2 in the first
screenshot). Then, structure of the currently visited file is shown (see
label 3 in the first scrrenshot). If there is a compile error, the
clickable error message is available (as with label 4 in the first
screenshot).

To run the project select "Run Project" from the AspectJ toolbar, or
click <ctrl>F12 while the editor pane is active. Note that the "AspectJ
Runtime" library must be added to your project in order to run. If the
library is not added you will see a "java.lang.NoClassDefFoundError:
org/aspectj/lang/Signature" error. The library is created automatically
for you from the runtime in "jbuilderdir/lib/ext". You can also create a
new library to use the runtime from a different location. If you have
not added the library to the "Required Libraries" of your project it
will be added automatically when you restart JBuilder.

JBuilder7 users please note: when you set up a run/debug configuration
you must select the "Build Target" (at the bottom of the "Runtime
Properties" dialog) to be "<None>". This will ensure that the Java
compiler is not invoked on your AspectJ sources before running or
debugging the project.

== Navigating the Program Structure

Navigation of program structure is provided by the xref:ajbrowser.adoc#ajbrowser[AspectJ Browser],
so apart from a JBuilder look and feel, the extra navigation AspectJ
allows work as described there. In particular, you can use views with
labels 1, 2 and 4 of the second screenshot to navigate structure using
the blue links, and you can set filtering and navigate history using the
toolbar shown by label 3 of the second screenshot.

== Manipulating Build Configurations

Build configurations can be manipulated adding, removing, and editing
build configuration files. The xref:ajbrowser.adoc#ajbrowser[AspectJ Browser] is used to select
the current build configuration. Configurations are represented by
".lst" files which are described in the xref:ajc.adoc[`ajc`, the AspectJ compiler/weaver] documentation.

=== Adding and Removing Build Configurations

By default all of the files contained in your project and within any
packages and subpackages that have been added to your project will be
compiled. In order to compile a different configuration first add it to
the project (by selecting "Add Files / Packages..." in the "Project"
menu, and selecting the desired build configuration file (see label 1 in
the third screenshot).

=== Editing Build Configurations

Double click a build configuration file in JBuilder's "Project Pane" in
order to edit it. Configurations can be edited as either text or in the
graphical designer (see labels 2 and 3 in the third screenshot)

== Example: Setting up the "Spacewar" Sample Project

To set up the Spacewar example first download it the
http://aspectj.org/dl[examples distribution]. Then

[arabic]
. launch JBuilder
. in the "File" menu select "New project"
. Select the location of the "aspectj/examples" directory for the
project. This is because the Spacewar example uses both the "spacewar"
and "coordination" packages, so we set up the project where it can get
at both packages.
. Choose a "jpr" project, either by typing in "Spacewar.jpr" as the
project name, or by typing "Spacewar" as the project name and "jpr" as
the type. Make sure "aspectj/examples" is still the directory for the
project.
. click "Finish"
. in the "Project" menu select "Project properties..."
. set the "Output path" entry to be the directory where you want your
classes to go
. set the "Output path" entry to be the directory where you want your
classes to go
. add "aspectjrt.jar" as a required library for the project. This
library is located in "<jbuilder-install-directory>/lib/ext".
. 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)
. Select the "examples" directory for the Souce.
. click "OK" to close the "Project Properties"dialog
. 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
thenext popup. Or directly choose "Add files/packages".
. <ctrl> select the "spacewar" and "coordination" packages and then
click "OK"; this will add the two packages to your project
. click the "Build Project" button (image:jbuilder-build.gif[image]) to
compile the project
. open the Structure View to browse the structure of the program
. click the "Run Project" button to play Spacewar (make sure that you
have set up the runtime library as described above)
. if you have not selected a class to run, you will be prompted to do
so: select the class "spacewar.Game".
. AspectJ related build options can be manipulated in the "AJDE
settings" window