[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
RE: [aspectj-users] RE: Capturing EventDispatch Thread
|
In this case, I think there's a workaround. You can replace the Swing EventQueue with one of your own. You'd want to create a trivial subclass of EventQueue and install that as the Swing event queue. Since it's now your code that's doing the call, I would expect weaving to work. You might have to also implement the dispatchEvent method as super.dispatchEvent.
To install the new event queue, you'd do the following.
Toolkit.getDefaultToolkit().getSystemEventQueue().push(new YourEventQueue());
Troy
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Ron DiFrango
> Sent: Tuesday, June 05, 2007 8:45 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] RE: Capturing EventDispatch Thread
>
> Dan,
>
> Unless your code directly calls the method then no you can
> not match the join point. This is especially true when it
> comes to code contained within the JDK/JRE libraries. You
> will have to capture pointcuts at high levels like the event
> code that you have for your buttons, mouse drags, etc.
>
> Ron DiFrango
> Architect/Lead Consultant
> Cap Tech Ventures, Inc
>
>
> _____
>
> From: aspectj-users-bounces@xxxxxxxxxxx on behalf of Fleck, Dan
> Sent: Tue 6/5/2007 8:31 AM
> To: aspectj-users@xxxxxxxxxxx
> Subject: RE: [aspectj-users] RE: Capturing EventDispatch Thread
>
>
>
> There are many calls to that in the Swing library that my
> code will trigger (although not call directly). My code
> creates swing events and actions (buttons, mouse drags,
> etc..). I know that within the code I pressed a button and
> had it generate a stack trace and at the bottom of the trace
> is the call (as expected) to:
>
> EventQueue.dispatchEvent(AWTEvent);
>
> It seems odd that the pointcut wouldn't hit it. Has anyone
> else tried this?
>
> Thanks,
> Dan
>
>
> -----Original Message-----
> From: aspectj-users-bounces@xxxxxxxxxxx
> [mailto:aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Eric Bodden
> Sent: Monday, June 04, 2007 6:32 PM
> To: aspectj-users@xxxxxxxxxxx
> Subject: Re: [aspectj-users] RE: Capturing EventDispatch Thread
>
> Are any calls of that in code that you actually weave into?
> If such calls only exist within the JRE and you don't weave
> into it, then it's clear that it cannot match.
>
> Eric
>
> On 04/06/07, Fleck, Dan <Dan_Fleck@xxxxxxx> wrote:
> >
> >
> >
> >
> > Hi,
> >
> >
> >
> > I am trying to capture and time calls to
> > java.awt.EventQueue.dispatchEvent(AWTEvent e).
> >
> >
> >
> > I am using the following code but it doesn't seem to work.
> Any ideas
> > why I'm not seeing the events? I added a lot of tries to get it but
> > nothing seemed to work. I do have other aspects that work fine.
> >
> >
> >
> > Thanks,
> >
> > Dan
> >
> >
> >
> > Code:---
> >
> ----------------------------------------------------------------------
> > -
> >
> >
> >
> > @Aspect
> >
> > public aspect SluggishDetector {
> >
> >
> >
> > pointcut dispatchPoint(java.awt.Component p1,
> java.awt.AWTEvent event):
> >
> > target(p1) && args(event) &&
> >
> > (
> >
> > call(void
> > *.dispatchEvent(java.awt.AWTEvent+))
> > ||
> >
> > call(void
> > *.dispatchEvent(java.awt.AWTEvent+))
> > ||
> >
> > execution(void
> > *.dispatchEvent(java.awt.AWTEvent+)) ||
> >
> > execution(void
> > *.dispatchEvent(java.awt.AWTEvent+))
> >
> > ) ;
> >
> >
> >
> > before(java.awt.Component p1, java.awt.AWTEvent event):
> > dispatchPoint(p1,
> > event) {
> >
> > System.err.println("ASPECTJ ***** SLUGGISH");
> >
> > }
> >
> > }
> >
> > ~
> > _______________________________________________
> > aspectj-users mailing list
> > aspectj-users@xxxxxxxxxxx
> > https://dev.eclipse.org/mailman/listinfo/aspectj-users
> >
> >
>
>
> --
> Eric Bodden
> Sable Research Group
> McGill University, Montréal, Canada
> _______________________________________________
> 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
>
>
> _______________________________________________
> aspectj-users mailing list
> aspectj-users@xxxxxxxxxxx
> https://dev.eclipse.org/mailman/listinfo/aspectj-users
>