Community
Participate
Working Groups
Bugzilla – Bug 293512
[Workbench] Make IWorkbench into an OSGi service
Last modified: 2009-12-08 14:07:19 EST
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
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.
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.
Created attachment 150729 [details] My proposal What do you think of this method?
Looks good. This is the optimal way to expose the workbench to OSGi, I guess.
Created attachment 152995 [details] workbench as a service v02 Just a record of what I actually checked in. PW
Released >20091124 PW
Thanks!
In I20091208-0100 PW