<html><head> | |
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1"> | |
<title>Navigating Program Structure</title><link rel="stylesheet" href="aspectj-docs.css" type="text/css"><meta name="generator" content="DocBook XSL Stylesheets V1.44"><link rel="home" href="index.html" title="The AspectJtm Development Environment Guide"><link rel="up" href="ajbrowser.html" title="Chapter 3. AspectJ Browser"><link rel="previous" href="ajbrowser-building.html" title="Building Programs"><link rel="next" href="ajbrowser-running.html" title="Running Programs"></head><body bgcolor="white" text="black" link="#0000FF" vlink="#840084" alink="#0000FF"><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Navigating Program Structure</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="ajbrowser-building.html">Prev</a> </td><th width="60%" align="center">Chapter 3. AspectJ Browser</th><td width="20%" align="right"> <a accesskey="n" href="ajbrowser-running.html">Next</a></td></tr></table><hr></div><div class="sect1"><a name="ajbrowser-navigating"></a><div class="titlepage"><div><h2 class="title" style="clear: both"><a name="ajbrowser-navigating"></a>Navigating Program Structure</h2></div></div><p> | |
Select nodes in the program structure by clicking them (see label 2). | |
If one node is related to one or more other nodes by an association the | |
name of the association will appear below that node and will be | |
displayed in italics. Links to other structure nodes appear in blue | |
below the association. If there is no corresponding source for the | |
link it will appear light-blue. | |
<span class="inlinemediaobject"><img src="ajbrowser-building.gif"></span> | |
</p><div class="sect2"><a name="example"></a><div class="titlepage"><div><h3 class="title"><a name="example"></a>Example: Exploring the "Spacewar" sample code </h3></div></div><p> | |
<div class="itemizedlist"><ul><li><p><a name="d0e1183"></a>Launch <tt>ajbrowser</tt></p></li><li><p><a name="d0e1188"></a>Choose "File -> Open" or click the "Open Build | |
Configuration" button | |
(<span class="inlinemediaobject"><img src="openConfig.gif"></span>) and select the configuration file for debugging | |
the spacewar example, in | |
<tt>examples/spacewar/debug.lst</tt>.</p></li><li><p><a name="d0e1198"></a>Click the "Build" button (<span class="inlinemediaobject"><img src="build.gif"></span>) to | |
compile. The left pane should fill with a spacewar declaration | |
tree. If there is a compiler error, the clickable error message | |
shows up as in label 4. | |
</p><p>Note: If you did not set up your classpath, the | |
compile will fail with a message that you need to install | |
aspectjrt.jar on your compile classpath. To do that, select "Tools | |
-> Options" or click the "Options" button | |
(<span class="inlinemediaobject"><img src="browseroptions.gif"></span>). Click the <tt>Build Options</tt> tab | |
to view the Build Paths pane. Edit the classpath entry to use your | |
install location. For example, if you ran from the base Aspectj | |
directory, the classpath need only include | |
<tt>lib/aspectjrt.jar</tt> (though the browser may populate | |
the classpath with the bootclasspath and classpath initially.) | |
Be sure to use the | |
<tt>lib/aspectjrt.jar</tt> that came with the browser. | |
</p><p> | |
<span class="inlinemediaobject"><img src="ajbrowser-options.gif"></span>> | |
</p></li><li><p><a name="d0e1226"></a>Different structure views: The structure tree at the | |
left can display different orderings and granularity for structure: | |
<div class="itemizedlist"><ul><li><p><a name="d0e1230"></a>The package hierarchy view shows the traditional hierarchy | |
of package, class, and members.</p></li><li><p><a name="d0e1233"></a>The inheritance view shows the hierarchy from topmost | |
parent classes through subclasses to members.</p></li><li><p><a name="d0e1236"></a>The crosscutting view shows the aspect members | |
and the code they affect.</p></li><li><p><a name="d0e1239"></a>Additional buttons in the pane can be used to change the | |
granularity and filter out items.</p></li></ul></div> | |
</p><p>Whenever you select an item in the tree view, the | |
source pane scrolls to that item. If you select a leaf item | |
representing another program element, then the tree | |
selection will go to the corresponding node. (See below for | |
how to use two panes to maintain your place.) | |
</p></li><li><p><a name="d0e1245"></a>When working with aspects, it helps to be able to navigate | |
between different program elements: | |
</p><div class="itemizedlist"><ul><li><p><a name="d0e1249"></a>When looking at a method, find the advice that | |
affects it. </p></li><li><p><a name="d0e1252"></a>When looking at a pointcut, find the advice that | |
uses it. </p></li><li><p><a name="d0e1255"></a>When looking at advice, find what it advises - | |
e.g., method calls or executions, initializers, etc. | |
</p></li><li><p><a name="d0e1258"></a>When looking at a type, find any aspects that | |
declare members or supertypes of the type, or | |
vice-versa. | |
</p></li></ul></div><p>You can view the advice on a particular method using the | |
default, hierarchical view. Navigate to the tree item for | |
<tt>spacewar.Registry.register(SpaceObject)</tt> | |
in the <tt>debug.lst</tt> config file. Now, in | |
the lower, file view, you can see and navigate to the advice | |
using the subtree whose parent is the <tt>method | |
affected by</tt> relation. | |
</p><p>You can also use crosscutting view to see the | |
advice using a pointcut or the methods affected by advice. | |
For example, to see what advice uses a particular pointcut, | |
navigate to the tree item for the pointcut | |
<tt>spacewar.Debug.allConstructorsCut()</tt> in | |
the <tt>debug.lst</tt> config file. You can see | |
and navigate to the advice that uses the pointcut using the | |
<tt>pointcut used by</tt> relation. | |
</p><p>As an example of seeing the methods affected by advice, | |
while still in the same view, select the first | |
<tt>before</tt> advice in | |
<tt>spacewar.Debug</tt>. It has relation | |
sub-trees for both <tt>uses pointcut</tt> and | |
<tt>affects constructions</tt>. The | |
<tt>affects</tt> relations will list different | |
kinds of join points - constructor or method calls, etc. | |
</p><p>Note that the AspectJ browser can only display | |
static structure (whether hierarchical or crosscutting). | |
That means that dynamicly-determined pointcuts (like | |
<tt>cflow(pointcut)</tt>) | |
will not be shown as picking out static points in | |
source code. Displayable pointcuts roughly correspond | |
to those that can be used in a | |
<tt>declare error</tt> statement. | |
</p></li></ul></div> | |
</p></div></div><div class="navfooter"><hr><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="ajbrowser-building.html">Prev</a> </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right"> <a accesskey="n" href="ajbrowser-running.html">Next</a></td></tr><tr><td width="40%" align="left">Building Programs </td><td width="20%" align="center"><a accesskey="u" href="ajbrowser.html">Up</a></td><td width="40%" align="right"> Running Programs</td></tr></table></div></body></html> |