Developing a Aspectj based plugin - Newbie questions [message #71141] |
Sun, 27 January 2008 01:48 |
André Fonseca Messages: 11 Registered: July 2009 |
Junior Member |
|
|
Hi,
I am working on a Eclipse plugin that I will need to capture some
information of the aspectj compiler, like aspects, pointcuts, etc., but
I'am facing some dificulties. In that example (
AsmRelationshipMapUsageTest method ,coded by Mik Kersten, that I tried to
adaptate to my plugin) I tried to capture the methods that are afected by
adivices:
public void FindAdvisedMethods() {
System.out.println("----------------------------------");
System.out.println("Methods affected by advice: ");
HierarchyWalker walker = new HierarchyWalker() {
public void preProcess(IProgramElement node) {
if (node.getKind().equals(IProgramElement.Kind.METHOD)) {
List relations =
AsmManager.getDefault().getRelationshipMap().get(node);
if (relations != null) {
for (Iterator it = relations.iterator();
it.hasNext(); ) {
IRelationship relationship =
(IRelationship)it.next();
if
(relationship.getKind().equals(IRelationship.Kind.ADVICE)) {
System.out.println(
"method: " + node.toString()
+ ", advised by: " +
relationship.getTargets());
}
}
}
}
}
};
AsmManager.getDefault().getHierarchy().getRoot().walk(walker );
}
In the last line comes the problem. The Eclipse's debug shows that
AsmManager.getDefault().getHierarchy().getRoot() returns null. Can anyone
explain me the possible reasons?
Another question: In the developer's guide
( http://wiki.eclipse.org/Developer%27s_guide_to_building_tool s_on_top_of_AJDT_and_AspectJ)
it seens to exist another way to do same thing that the method abdove is
doing. If it is correct, what implementation i should use and why?
Another thing: If I choose to implement the way that is used in the
developer's guide, how I could get another informations like: aspects,
pointcuts, declare parents, etc.?
Thanks evebory that is reading this mail and sorry the poor english!
André Fonseca
|
|
|
Powered by
FUDForum. Page generated in 0.03299 seconds