Source:
private Workbench(Display display, final WorkbenchAdvisor advisor, MApplication app, IEclipseContext appContext) { super(); this.id = createId(); StartupThreading.setWorkbench(this); if (instance != null && instance.isRunning()) { throw new IllegalStateException(WorkbenchMessages.Workbench_CreatingWorkbenchTwice); } Assert.isNotNull(display); Assert.isNotNull(advisor); this.advisor = advisor; this.display = display; application = app; e4Context = appContext; Workbench.instance = this; eventBroker = (IEventBroker) e4Context.get(IEventBroker.class.getName()); appContext.set(getClass().getName(), this); appContext.set(IWorkbench.class.getName(), this); appContext.set(IEventLoopAdvisor.class, new IEventLoopAdvisor() { public void eventLoopIdle(Display display) { advisor.eventLoopIdle(display); } public void eventLoopException(Throwable exception) { advisor.eventLoopException(exception); } }); extensionEventHandler = new ExtensionEventHandler(this); Platform.getExtensionRegistry().addRegistryChangeListener(extensionEventHandler); IServiceLocatorCreator slc = new ServiceLocatorCreator(); serviceLocator = (ServiceLocator) slc.createServiceLocator(null, null, new IDisposable() { public void dispose() { final Display display = getDisplay(); if (display != null && !display.isDisposed()) { MessageDialog.openInformation(null, WorkbenchMessages.Workbench_NeedsClose_Title, WorkbenchMessages.Workbench_NeedsClose_Message); close(PlatformUI.RETURN_RESTART, true); } } }, appContext); serviceLocator.registerService(IServiceLocatorCreator.class, slc); serviceLocator.registerService(IWorkbenchLocationService.class, new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null, null, null, 0)); Hashtable<String, Object> properties = new Hashtable<String, Object>(); properties.put("id", getId()); osgiRegistration = Activator.getDefault().getContext() .registerService(IWorkbench.class.getName(), this, properties); }

Target:
private Workbench(Display display, final WorkbenchAdvisor advisor, MApplication app, IEclipseContext appContext) { super(); this.id = createId(); StartupThreading.setWorkbench(this); if (instance != null && instance.isRunning()) { throw new IllegalStateException(WorkbenchMessages.Workbench_CreatingWorkbenchTwice); } Assert.isNotNull(display); Assert.isNotNull(advisor); this.advisor = advisor; this.display = display; application = app; e4Context = appContext; Workbench.instance = this; eventBroker = (IEventBroker) e4Context.get(IEventBroker.class.getName()); appContext.set(getClass().getName(), this); appContext.set(IWorkbench.class.getName(), this); appContext.set(IEventLoopAdvisor.class, new IEventLoopAdvisor() { public void eventLoopIdle(Display display) { advisor.eventLoopIdle(display); } public void eventLoopException(Throwable exception) { advisor.eventLoopException(exception); } }); extensionEventHandler = new ExtensionEventHandler(this); Platform.getExtensionRegistry().addRegistryChangeListener(extensionEventHandler); IServiceLocatorCreator slc = new ServiceLocatorCreator(); serviceLocator = (ServiceLocator) slc.createServiceLocator(null, null, new IDisposable() { public void dispose() { final Display display = getDisplay(); if (display != null && !display.isDisposed()) { MessageDialog.openInformation(null, WorkbenchMessages.Workbench_NeedsClose_Title, WorkbenchMessages.Workbench_NeedsClose_Message); close(PlatformUI.RETURN_RESTART, true); } } }, appContext); serviceLocator.registerService(IServiceLocatorCreator.class, slc); serviceLocator.registerService(IWorkbenchLocationService.class, new WorkbenchLocationService(IServiceScopes.WORKBENCH_SCOPE, this, null, null, null, null, 0)); }