Community
Participate
Working Groups
The declarative service for calling the tracing initializer class in the org.eclipse.ui.trace bundle can cause the workspace prompt to not display. If this service is run before the workspace is initialized then its activator class will attempt to access the instance scoped preferences (i.e. workspace preferences): @Override public void start(final BundleContext context) throws Exception { ... if (DebugOptionsHandler.isTracingEnabled()) { ... } else if (PreferenceHandler.isTracingEnabled()) { <-- accesses prefs in workspace ... } } As a result of doing this action before the workspace is initialized then the workspace location is set to be the location specified via the osgi.instance.area.default configuration property and the prompt is not displayed to change it. I'm marking this as 'major' since our Eclipse-based product causes this situation to occur and the workspace prompt never displays.
If we can't find a better solution, we should be able to implement IStartup to load preference information after a workspace is selected.
I would also like to request that a solution needs to be implemented in the 4.2.2 release.
We can fall back to using Eclipse early start (IStartup), but Paul has suggested two possible alternatives. 1) Keep the DS in place When the bundle is activated, check that org.eclipse.core.runtime.Platform.getInstanceLocation().isSet() returns true If it is, access the preferences If not, register a StartupMonitor service which will be called during splash takedown (this is earlier than IStartup). When we get the call back, preferences will be available. 2) Have the DS depend on the IWorkbench service Implementing 2 is easier, but tracing would not be enabled until much later during startup.
Created attachment 224277 [details] Potential patch using the StartupMonitor suggestion
Fixed in master: http://git.eclipse.org/c/pde/eclipse.pde.ui.git/commit/?id=8d46594bf85c01f5e7f84c9f4485c4659cbf2fc5 The patch worked great, thanks Troy. Note for testing that you can get the workspace prompt to open when self hosting by deleting the workspace location in your launch configuration. I separated out the non-nls tag change into a separate commit to make it easier to cherry pick when backporting. I also changed the startup monitor to store its own service reference and unregister itself after initializing the preferences. I will clone this bug for 3.8.2/4.2.2.