Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] problems with pointcut referenced by advice instances

Hi Jimy,

As far as I know, there is no way to do this directly because
AdviceElement has no children.  However, you should be able to do this
by parsing the source code.

You need access to the source code of the compilation unit.
Presumably, this would be in an IDocument object.

(warning---I haven't compiled this code!)

String adviceText =
document.get(adviceElement.getSourceRange().getOffset(),
adviceElement.getSourceRange().getLength()
ASTParser parser = ASTParser.newParser(AST.JLS3);
parser.setKind(K_CLASS_BODY_DECLARATIONS);
parser.setSource(adviceText);
ASTNode advice = parser.createAST(null);

Make sure you use the correct version of ASTParser
(org.aspectj.org.eclipse.jdt.core.dom.ASTParser).  Hope this can help.

--a

ps- since this is a question about AJDT, perhaps a better place for
this question would have been on the AJDT users mailing list.

On Thu, May 22, 2008 at 11:21 AM, Jimy Juliet <makomenos@xxxxxxxxx> wrote:
> Hello to everybody!
>
> I have this problem:
>
> from an instance of org.eclipse.ajdt.core.javaElements.AdviceElement
> I need to retrieve the associated pointcut (maybe an instance of
> PointcutElement).
>
> Is there a way to do this?
>
> Thank you
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>
>


Back to the top