I presume the classes for the java files located in the simple java project have not yet been loaded when the button is pressed? And so you just want to do load time weaving basically and apply the aspect as they are loaded? In these situations you might use the WeavingURLClassLoader ( http://www.eclipse.org/aspectj/doc/next/weaver-api/org/aspectj/weaver/loadtime/WeavingURLClassLoader.html) - this has been recently discussed a bit on the list so if you go through the archives you'll see some tips on using it.
If the files have already been loaded, that is much more tricky. Either they need to be loaded by a loader that you can orphan/discard and then you can load them in again, or you need to do some trickery with hotswap, but that will get messy. Usually the simple approach is to weave in your aspect always but ensure all advice calls use a very cheap boolean check so they know whether they apply. Then when you press the button you are just flipping whatever boolean the aspect was checking. Andy On 22 April 2013 15:49, mohamed ilyas Rahim <[email protected]> wrote: > Hi, > I have load-time weaving enabled in eclipse, and it works when I use it > more conventionally. > I have a simple java project with java classes only, and another aspectj > project with no aspect files but with an user interface contain one > button. > > i wish that when users click the button then the event handler method of > the button will load aspect from a folder in my hard disk, for exemple > in: C:\aspect, and weave this aspect with the java files located in the > simple java project. > > can anyone suggest the implementation of the event handler method of the > button ? > > Thanks for any suggestions. > ilyas > > _______________________________________________ > aspectj-users mailing list > [email protected] > https://dev.eclipse.org/mailman/listinfo/aspectj-users > >
_______________________________________________ aspectj-users mailing list [email protected] https://dev.eclipse.org/mailman/listinfo/aspectj-users
