Bug 293512 - [Workbench] Make IWorkbench into an OSGi service
[Workbench] Make IWorkbench into an OSGi service
Status: VERIFIED FIXED
Product: Platform
Classification: Eclipse
Component: UI
3.5
PC Windows XP
: P3 enhancement (vote)
: 3.6 M4
Assigned To: Paul Webster CLA Friend
Paul Webster CLA Friend
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2009-10-27 16:54 EDT by Min Idzelis CLA Friend
Modified: 2009-12-08 14:07 EST (History)
3 users (show)

See Also:


Attachments
My proposal (2.18 KB, patch)
2009-10-28 10:04 EDT, Min Idzelis CLA Friend
pwebster: iplog+
Details | Diff
workbench as a service v02 (4.00 KB, patch)
2009-11-24 14:22 EST, Paul Webster CLA Friend
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Min Idzelis CLA Friend 2009-10-27 16:54:11 EDT
User-Agent:       Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.1.3) Gecko/20090824 Firefox/3.5.3
Build Identifier: 

I would like to be when the IWorkbench is available for use. I am currently being started before the IWorkbench is ready and it is causing severe problems. If IWorkbench was a OSGi service, then I could use a ServiceTracker to acquire the initialized IWorkbench when it is available. 

Reproducible: Always
Comment 1 Min Idzelis CLA Friend 2009-10-27 16:59:39 EDT
Wow, I was typing way too fast. The first sentence should read: 

I would like to be informed when the IWorkbench has been fully initialized and is available for use.
Comment 2 Philipp Kursawe CLA Friend 2009-10-28 02:17:56 EDT
I also had this requirement to let my dynamic services depend on IWorkbench. I have put this code into one of my bundles activators.

new Job("IWorkbench service registrar") { //$NON-NLS-1$
	@Override
	public IStatus run(final IProgressMonitor monitor) {
		if (PlatformUI.isWorkbenchRunning()) {
			final IWorkbench workbench = PlatformUI.getWorkbench();
			context.registerService(IWorkbench.class.getName(), workbench, null);
		} else {
			schedule(500);
		}
		return Status.OK_STATUS;
	}
}.schedule();

First I tried to use a WorkbenchJob but when you schedule them the workbench must be already running or they are discarded.

I could also provide a patch for Eclipse that registers the workbench as a service from inside the Workbench implementation.
Comment 3 Min Idzelis CLA Friend 2009-10-28 10:04:59 EDT
Created attachment 150729 [details]
My proposal

What do you think of this method?
Comment 4 Philipp Kursawe CLA Friend 2009-10-28 10:33:29 EDT
Looks good. This is the optimal way to expose the workbench to OSGi, I guess.
Comment 5 Paul Webster CLA Friend 2009-11-24 14:22:30 EST
Created attachment 152995 [details]
workbench as a service v02

Just a record of what I actually checked in.

PW
Comment 6 Paul Webster CLA Friend 2009-11-24 14:23:25 EST
Released >20091124
PW
Comment 7 Min Idzelis CLA Friend 2009-11-24 14:32:52 EST
Thanks!
Comment 8 Paul Webster CLA Friend 2009-12-08 14:07:19 EST
In I20091208-0100
PW