Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » AspectJ » Is it possible to add aspectj code to the eclipse platform
Is it possible to add aspectj code to the eclipse platform [message #1094834] Mon, 26 August 2013 09:00 Go to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
Since the eclipse 3.x is based on OSGi framework i am wondering if I can develop the eclipse project in my eclipse 3.x and even add aspectj code to the eclipse?
Re: Is it possible to add aspectj code to the eclipse platform [message #1095104 is a reply to message #1094834] Mon, 26 August 2013 16:26 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
Of course there is!

Take a look at Equinox Weaving: http://eclipse.org/equinox/weaving/

Since OSGi uses separate classloaders for each bundle, there needs to be a new kind of support for weaving. EW is meant for load time weaving only. If you want to do compile time weaving, then you can use a regular aspectj compiler. But this only works if you only weave into code that you produce.
icon10.gif  Re: Is it possible to add aspectj code to the eclipse platform [message #1095349 is a reply to message #1095104] Tue, 27 August 2013 00:27 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
thk u for answering. i have been viewed the link and i have developed some equinox aspectj projects.the question confuse me most is if the eclipse3.x source code could be import into the eclipes workspace like an standard osgi project(as the attachment)? i have tried serveal times but all failed.
  • Attachment: 1.png
    (Size: 10.21KB, Downloaded 327 times)

[Updated on: Tue, 27 August 2013 00:43]

Report message to a moderator

Re: Is it possible to add aspectj code to the eclipse platform [message #1095424 is a reply to message #1095349] Tue, 27 August 2013 03:22 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
As of Eclipse Juno, there should be no problems importing Equinox Weaving into an Eclipse instance. However, the next version of Eclipse (to be released in June 2014( will have some incompatibilities and we will need to make some changes to EW in order to get this working.

However, as long as you are working with Juno or earlier, you should be fine.
Re: Is it possible to add aspectj code to the eclipse platform [message #1095531 is a reply to message #1095424] Tue, 27 August 2013 07:20 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
thk u , so what i want to do is downloading the souce code of eclipse and just import into my workspace? i did import the source code of eclipse3.1.1 to the eclipse ide(3.7) which reported a lot of errors(attachment). did i misunderstand your meaning?

[Updated on: Tue, 27 August 2013 07:22]

Report message to a moderator

Re: Is it possible to add aspectj code to the eclipse platform [message #1095839 is a reply to message #1095531] Tue, 27 August 2013 15:48 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
You should not need to import anything from Eclipse 3.1.1. All you need is to have Equinox Weaving in your target platform. Read more about target platforms here: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.pde.doc.user%2Fconcepts%2Ftarget.htm

You can add Equinox Weaving to your target platform through the AJDT update site, here: http://download.eclipse.org/tools/ajdt/43/update

There is an Equinox Weaving feature that you can use.
Re: Is it possible to add aspectj code to the eclipse platform [message #1096172 is a reply to message #1095839] Wed, 28 August 2013 03:30 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
Ok, i got it ,thk u very much!
Re: Is it possible to add aspectj code to the eclipse platform [message #1109837 is a reply to message #1095839] Mon, 16 September 2013 03:04 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
Hi,since last time I got instruction from u ,i have successfully weaving my aspect code to the eclipse platform by EW. However, it seems that not every bundle could be added aop code. I am confused. I successfully added aspect to the org.eclipse.ui.workbench and org.eclipse.core.databinding.observable, so it should be success on all the bundles, should not it? Here is my failed case:
I was try to add aop to the org.eclipse.equinox.app and my aspect project is like this
package org.eclipse.equinox.app.aspect.aspect;

public aspect MyAspect {
	before() :execution( synchronized void org.eclipse.equinox.internal.app.EclipseAppHandle.setAppStatus(int)){
		System.out.print("Hello");
	}
}

and my MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Aspect
Bundle-SymbolicName: org.eclipse.equinox.app.aspect
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.equinox.app.aspect.activator.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.equinox.app;version="1.1.0",
 org.osgi.framework;version="1.3.0"
Require-Bundle: org.aspectj.runtime
Export-Package: org.eclipse.equinox.app.aspect.aspect
Eclipse-SupplementBundle: org.eclipse.equinox.app

and my attempts to add aop to the org.eclipse.equinox.launcher and the org.eclipse.osgi were also failed.
Is my aspect code have some problems or not every bundles of eclipse platform can be add aop code?
Re: Is it possible to add aspectj code to the eclipse platform [message #1109858 is a reply to message #1109837] Mon, 16 September 2013 03:52 Go to previous messageGo to next message
Andrew Eisenberg is currently offline Andrew EisenbergFriend
Messages: 382
Registered: July 2009
Senior Member
Your problem is with bootstrapping. There are a few bundles that need to be loaded before EW can be loaded. org.eclipse.osgi and org.eclipse.equinox.launcher are two of them. There aren't many others, but I think there are a few. You can minimize the number of unweavable bundles by ensuring the start level for org.eclipse.equinox.weaving.aspectj is set to level 1.

But, unfortunately, there is no way of getting around not being able to weave into these very early starting bundles. You can try going for compile time weaving.
Re: Is it possible to add aspectj code to the eclipse platform [message #1109897 is a reply to message #1095839] Mon, 16 September 2013 05:15 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
Hi,since last time I got instruction from u ,i have successfully weaving my aspect code to the eclipse platform by EW. However, it seems that not every bundle could be added aop code. I am confused. I successfully added aspect to the org.eclipse.ui.workbench and org.eclipse.core.databinding.observable, so it should be success on all the bundles, should not it? Here is my failed case:
I was try to add aop to the org.eclipse.equinox.app and my aspect project is like this
package org.eclipse.equinox.app.aspect.aspect;

public aspect MyAspect {
	before() :execution( synchronized void org.eclipse.equinox.internal.app.EclipseAppHandle.setAppStatus(int)){
		System.out.print("Hello");
	}
}

and my MANIFEST.MF
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Aspect
Bundle-SymbolicName: org.eclipse.equinox.app.aspect
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: org.eclipse.equinox.app.aspect.activator.Activator
Bundle-ActivationPolicy: lazy
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Import-Package: org.eclipse.equinox.app;version="1.1.0",
 org.osgi.framework;version="1.3.0"
Require-Bundle: org.aspectj.runtime
Export-Package: org.eclipse.equinox.app.aspect.aspect
Eclipse-SupplementBundle: org.eclipse.equinox.app

and my attempts to add aop to the org.eclipse.equinox.launcher and the org.eclipse.osgi were also failed.
Is my aspect code have some problems or not every bundles of eclipse platform can be add aop code?
Re: Is it possible to add aspectj code to the eclipse platform [message #1109898 is a reply to message #1095839] Mon, 16 September 2013 05:15 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
No Message Body

[Updated on: Mon, 16 September 2013 05:20]

Report message to a moderator

Re: Is it possible to add aspectj code to the eclipse platform [message #1109902 is a reply to message #1109858] Mon, 16 September 2013 05:19 Go to previous messageGo to next message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
OK, i once thought about that but i am not sure . Thanks Andrew!Smile
Re: Is it possible to add aspectj code to the eclipse platform [message #1110121 is a reply to message #1109858] Mon, 16 September 2013 11:59 Go to previous message
Jun Yu is currently offline Jun YuFriend
Messages: 11
Registered: August 2013
Junior Member
By the way, for my current work i have to understand the relationship between each plugin of eclipse platform. i have started to read the source code of eclipse platform, but a lot of time would be taken, so i wonder if there is somewhere introduce the functions of each bundle of eclipse platform or not so that i can focus on my job directly.
Previous Topic:Adding annotation to methods & their parameters
Next Topic:How AJDT manage its updates?
Goto Forum:
  


Current Time: Tue Apr 23 13:59:59 GMT 2024

Powered by FUDForum. Page generated in 0.04080 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top