[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
Re: [ajdt-dev] Getting all aspects in the project
|
Accessing the data through the visualiser
is certainly one option but perhaps not the best way.
The key thing you need to know is that
there is one structure model per project and there is
only one active structure model at any
one time. So if you are working in project A, you
cannot ask information about the structure
model of project B. Perhaps the better way for
you to access the data you need is by
walking the hierarchy of IProgramElement nodes
that make up all the code for a particular
project.
You can obtain the programElement hierarchy
by making this call:
AsmManager.getDefault().getHierarchy().getRoot()
That gives you a root IProgramElement
that represents the .lst file that was used to compile
the project. You can then walk
down the hierarchy using getKind() to check what each node
is and getChildren() to navigate to
the next level. The kind of a node is of type IProgramElement.Kind
and all the kinds you need are defined
POINTCUT, ASPECT, ADVICE.
There is a way to force it to switch
to the structure model for a different project, other
than causing it to happen through the
UI, but I can't quite remember what that is
without looking at the code.
Andy.
Irum Godil <softwarengineer2003@xxxxxxxxx>
Sent by: ajdt-dev-admin@xxxxxxxxxxx
25/06/2004 16:39
Please respond to
ajdt-dev |
|
To
| ajdt-dev@xxxxxxxxxxx
|
cc
|
|
Subject
| [ajdt-dev] Getting all aspects
in the project |
|
Hi,
I am working on adding some features to the ajdt code
base. For that, I want a list of all the aspects in the selected project
with the pointcuts and warnings declared in each aspect. I tried using
the following code:
AspectVisualiserPlugin plugin = AspectVisualiserPlugin.getDefault();
IJavaProject proj = JavaCore.create(ResourcesPlugin.getWorkspace().getRoot().getProject("newProj"));
Set set = plugin.getAllAspects(proj);
However, the above set is always empty. Can someone please
tell me why is this set always empty. I tried to understand the code for
StructureModelUtil's method:
public static
Map getLinesToAspectMap(String sourceFilePath,boolean
needIndividualNodes)
but I am not sure what is it doing.
Can someone please tell me how can I get all aspects of
a project listed out, and which API to use for that purpose.
Thanks.
Do you Yahoo!?
Yahoo! Mail is new and improved - Check
it out!