Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [ajdt-dev] AJModel - Getting details about PointcutElement, AdviceElement and DeclareElements

Hi Andrew!

Thanks for your help! But I still have some doubts that I would like to share here.

On Sat, Apr 4, 2009 at 3:59 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:
Let's say that pointcutElement is of type PointcutElement:

AJProjectModelFacade model =
AJProjectModelFactory.getInstance().getModelForJavaElement(pointcutElement);

IProgramElement ipe = model.javeElementToProgramElement(poincutElement);

And you can get a bunch of information about the pointcut that you
couldn't before.


Well... I got the IProgramElement from my PointcutElements but I couldn't see how to get the information about the pointcut declaration from that. I read somewhere that I could get that information with the getDetails method, but it is returning null for all my pointcuts.


 On Sat, Apr 4, 2009 at 3:59 PM, Andrew Eisenberg <andrew@xxxxxxxxxxxx> wrote:

> However, I could not cast the PointcutElement  into ISourceReference.

Why not?  PoincutElement implements ISourceReference.
Make sure you are using org.eclipse.jdt.core.ISourceReference and not
org.aspectj.org.eclipse.jdt.core.ISourceReference.

Ok, that realy did the trick. However I could not get the information about the pointcut declaration in the string that I got from the getSource method.

Ex: If I cast pointcutElement to ISourceElement and try to call the method getSource of the pointcut:

pointcut goCut(): cflow(this(Demo) && execution(void go()));

i will receive the string:

pointcut goCut()                                                              ;

I also try to parse the source of the AspectElement that contain the PointcutElement abdove, using the ASTParser, however, all references to the pointcuts in this source were like that example. Is that a bug?

Thanks again!

--
André Fonseca
http://sites.google.com/site/andrefonsecacv/
pt-br: http://sites.google.com/site/andrefonsecacv/ptbr
Linux User #414248

Back to the top