Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [aspectj-users] Using AspectJ in an Eclipse Application?

doh!

Dead on, Matt.

Thanks!


-phil




Matt Chapman wrote:
Hi Phil,

I think the problem is with your pointcut - if your SampleAction class
is in a package called say "myplugin.actions", this will not be
matched by "*.SampleAction", because "*" matches zero or more
characters characters except for ".". Therefore to match
"myplugin.actions.SampleAction" you could do "*.*.SampleAction", or
"*..SampleAction" to match regardless of package hierarchy. You could
also just use an absolute type name of "SampleAction", with an import
from the appropriate package. As soon as your pointcut starts matching
something, an advice marker should appear in the left hand edge of the
editor.

Regards,

Matt.

On 16/08/05, Phil Quitslund <pq@xxxxxxxxxx> wrote:

Hi all,

First, I should apologize for what's probably a _really_ stupid question (or at
least one that's been answered countless times before).

Anyway, if I haven't lost you yet here goes:

Suppose I'm trying to use AspectJ in the context of a simple HelloWorld plugin
(you know: the one that adds a button to your toolbar that runs a sample action
that opens an Info message).  My aspect does something imaginative like print
something to the console when the sample action fires:

public aspect Test {
       before(): execution(public void *.SampleAction.run(..)) {
               System.err.println("got it!");
       }
}

But no dice.

Obvious question, probably, but what's the trick?  I've fussed with various
aspectj project options but haven't stumbled across the right thing.

Any thoughts would be appreciated.


-phil


Incidentally, I'm using Eclipse 3.1 (Build id: I20050627-1435)

and as for AspectJ, I've tried:

Version: 1.3.0
Build id: 20050812155128
AspectJ version: 1.5.0M2

and

Version: 1.3.0
Build id: 20050815121712
AspectJ version: 1.5.0M2
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users



Back to the top