Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 501918

Summary: Remove dependency org.eclipse.osgi from o.e.e4.ui.services
Product: [Eclipse Project] Platform Reporter: Dirk Fauth <dirk.fauth>
Component: UIAssignee: Dirk Fauth <dirk.fauth>
Status: RESOLVED FIXED QA Contact:
Severity: enhancement    
Priority: P3 CC: daniel_megert, Lars.Vogel, psuzzi
Version: 4.7   
Target Milestone: 4.7 M4   
Hardware: PC   
OS: Windows 7   
See Also: https://git.eclipse.org/r/81628
https://git.eclipse.org/c/platform/eclipse.platform.ui.git/commit/?id=7131b4c3382420058bf7f66827a13bddc7426b0b
https://bugs.eclipse.org/bugs/show_bug.cgi?id=512052
Whiteboard:

Description Dirk Fauth CLA 2016-09-21 09:12:01 EDT
I noticed that o.e.e4.ui.services has a bundle dependency to org.eclipse.osgi

I personally think it is wrong to be dependent on a specific OSGi framework and would like to clean up the dependencies.

From my observation there are two reasons for that dependency:

1. Usage of the ServiceTracker
This can be solved easily by adding the appropriate Import Package statement

2. Usage of NLS
This is a tricky bit, as org.eclipse.osgi.util.NLS is special to Equinox and therefore the Import Package solution will still introduce a dependency to org.eclipse.osgi.

I investigated two possible solutions for this:

a) Use @Translation to inject the messages and be able to benefit from locale changes at runtime. Unfortunately this introduces race conditions as the necessary services in o.e.e4.core.services are not started yet. And even if they are, the necessary locale is not available when starting the EventBroker. This is surely solvable somehow.

b) Implement a simple messages class that accesses the resource bundle on demand. 

I personally tend to go for the second solution. The reason is that the messages are only used for logging in case the EventAdmin or the BundleContext are not available.

IMHO the static initialization of a NLS class for two messages that are only used for error logging in case everything is broken seems to me unnecessary an not performant on that framework level. 

As it is also internal API such a change should not be considered as a breaking change.

I can provide a patch. But first I wanted to ask for opinions on this.
Comment 1 Eclipse Genie CLA 2016-09-21 15:47:52 EDT
New Gerrit change created: https://git.eclipse.org/r/81628
Comment 3 Lars Vogel CLA 2016-10-31 12:13:48 EDT
Mass move to M4.
Comment 4 Lars Vogel CLA 2016-12-06 13:13:32 EST
Dirk, should this be marked as fixed with the commit?