Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
[aspectj-users] RE: Aspect for clicking on a JButton

So I got something almost working. I am not sure whether my pointcut or advice are causing the problem. It works, but I get some weird exception after it works :(

after(ActionEvent e) : args(e) && execution(void java.awt.event.ActionListener+.actionPerformed(ActionEvent))
	{
		if(e.getActionCommand().equals("Commit"))
			System.out.println("Commit clicked");
	}

It prints the string only when that specific button is clicked, but then I get some unexpected Exception, and walking through the debugger did not help me find it. It just goes to the  Please help if you have any ideas. Here is what my output looks like from the console.

Commit clicked
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
	at org.eclipse.equinox.weaving.hello.aspects.HelloAspect.ajc$after$org_eclipse_equinox_weaving_hello_aspects_HelloAspect$4$1bc128eb(HelloAspect.aj:54)
	at org.eclipse.equinox.weaving.demo.hello.internal.Activator$RawFileControlUICallback.actionPerformed(Activator.java:166)
	at undo.UndoServiceImp.commit(UndoServiceImp.java:42)
	at org.eclipse.equinox.weaving.demo.hello.internal.Activator$2.actionPerformed(Activator.java:101)
	at javax.swing.AbstractButton.fireActionPerformed(AbstractButton.java:1995)
	at javax.swing.AbstractButton$Handler.actionPerformed(AbstractButton.java:2318)
	at javax.swing.DefaultButtonModel.fireActionPerformed(DefaultButtonModel.java:387)
	at javax.swing.DefaultButtonModel.setPressed(DefaultButtonModel.java:242)
	at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(BasicButtonListener.java:236)
	at java.awt.Component.processMouseEvent(Component.java:6263)
	at javax.swing.JComponent.processMouseEvent(JComponent.java:3267)
	at java.awt.Component.processEvent(Component.java:6028)
	at java.awt.Container.processEvent(Container.java:2041)
	at java.awt.Component.dispatchEventImpl(Component.java:4630)
	at java.awt.Container.dispatchEventImpl(Container.java:2099)
	at java.awt.Component.dispatchEvent(Component.java:4460)
	at java.awt.LightweightDispatcher.retargetMouseEvent(Container.java:4574)
	at java.awt.LightweightDispatcher.processMouseEvent(Container.java:4238)
	at java.awt.LightweightDispatcher.dispatchEvent(Container.java:4168)
	at java.awt.Container.dispatchEventImpl(Container.java:2085)
	at java.awt.Window.dispatchEventImpl(Window.java:2475)
	at java.awt.Component.dispatchEvent(Component.java:4460)
	at java.awt.EventQueue.dispatchEvent(EventQueue.java:599)
	at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
	at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
	at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
	at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
	at java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
________________________________________
From: aspectj-users-bounces@xxxxxxxxxxx [aspectj-users-bounces@xxxxxxxxxxx] On Behalf Of Kashtan, Daniel [Daniel.Kashtan@xxxxxxx]
Sent: Tuesday, June 29, 2010 11:28 AM
To: aspectj-users@xxxxxxxxxxx
Subject: [aspectj-users] Aspect for clicking on a JButton

Hey all,

I am having a hard time trying to figure out how to make a pointcut that can trigger when a JButton is clicked. Also, would I be able to target specific buttons being clicked? What can I do?

This e-mail and any files transmitted with it may be proprietary and are intended solely for the use of the individual or entity to whom they are addressed. If you have received this e-mail in error please notify the sender.
Please note that any views or opinions presented in this e-mail are solely those of the author and do not necessarily represent those of ITT Corporation. The recipient should check this e-mail and any attachments for the presence of viruses. ITT accepts no liability for any damage caused by any virus transmitted by this e-mail.
_______________________________________________
aspectj-users mailing list
aspectj-users@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/aspectj-users


Back to the top