Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 284319 - Remove empty Activators and replace Activator.ID Strings with dynamic Bundle symbolic name
Summary: Remove empty Activators and replace Activator.ID Strings with dynamic Bundle ...
Status: RESOLVED FIXED
Alias: None
Product: Platform
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 3.7   Edit
Hardware: All All
: P3 enhancement (vote)
Target Milestone: 4.1   Edit
Assignee: Project Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2009-07-22 14:24 EDT by Philipp Kursawe CLA
Modified: 2011-05-17 16:23 EDT (History)
4 users (show)

See Also:


Attachments
Initial patch for UI & core bundles (9.51 KB, patch)
2009-07-22 14:27 EDT, Philipp Kursawe CLA
john.arthorne: iplog+
Details | Diff
mylyn/context/zip (859 bytes, application/octet-stream)
2009-07-22 14:27 EDT, Philipp Kursawe CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Philipp Kursawe CLA 2009-07-22 14:24:22 EDT
I have deleted empty Activators and replaced the String literal of ID with FrameworkUtil.getBundle(...class).getSymbolicName().
Comment 1 Philipp Kursawe CLA 2009-07-22 14:27:13 EDT
Created attachment 142306 [details]
Initial patch for UI & core bundles
Comment 2 Philipp Kursawe CLA 2009-07-22 14:27:25 EDT
Created attachment 142307 [details]
mylyn/context/zip
Comment 3 Chris Aniszczyk CLA 2009-07-22 14:31:15 EDT
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.
Comment 4 Philipp Kursawe CLA 2009-07-22 14:48:41 EDT
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.
Comment 5 Thomas Watson CLA 2009-07-22 15:22:38 EDT
(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 ;-))
Comment 6 John Arthorne CLA 2009-08-14 15:30:16 EDT
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).