Community
Participate
Working Groups
I have deleted empty Activators and replaced the String literal of ID with FrameworkUtil.getBundle(...class).getSymbolicName().
Created attachment 142306 [details] Initial patch for UI & core bundles
Created attachment 142307 [details] mylyn/context/zip
The only thing I'll note here is that by using FrameworkUtil, we tie ourselves to a specific version of the 'org.osgi.framework' package. When was FrameworkUtil added Tom? If this isn't an issue, that's fine. If it is, we could use PackageAdmin instead.
Its part of OSGi R4 I think. So for E4 it should be ok to use, they even share the "4" in the name :) Also could just use "((BundleReference)class.getClassLoader()).getBundle(). Works since OSGi earlier than R4.
(In reply to comment #4) > Its part of OSGi R4 I think. So for E4 it should be ok to use, they even share > the "4" in the name :) Also could just use > "((BundleReference)class.getClassLoader()).getBundle(). Works since OSGi > earlier than R4. > FrameworkUtil.getBundle and BundleReference were both added in OSGi v4.2 and was first implemented in Galileo. I don't see any issue with e4 depending on Galileo or later, do you? Using PackageAdmin is going to be a challenge from static initializer code that has no access to a BundleContext (and has no activator to get one ;-))
I released most of the patch in HEAD (the empty activators). I omitted the change to use FrameworkUtil for the bundle id. Bundle id renaming is so rare that it isn't worth adding this. And, we use this same convention in almost every other Eclipse bundle so changing just a single bundle is inconsistent and doesn't help much. Getting rid of the empty activators is great though, so thanks for the patch. Anywhere we can avoid referencing OSGI APIs unnecessarily is great as it increases the reuse of the component (plain Java apps, etc).