Source:
private void instantiate() { final Bundle bundle = FrameworkUtil.getBundle(getClass()); if (bundle != null) { final BundleContext bundleContext = bundle.getBundleContext(); final ServiceReference<EMFFormsLegacyServicesFactory> serviceReferenceLegacy = bundleContext .getServiceReference(EMFFormsLegacyServicesFactory.class); if (serviceReferenceLegacy != null) { final EMFFormsLegacyServicesFactory legacyServicesFactory = bundleContext .getService(serviceReferenceLegacy); legacyServicesFactory.instantiate(); bundleContext.ungetService(serviceReferenceLegacy); } final ServiceReference<EMFFormsViewServiceManager> serviceReference = bundleContext .getServiceReference(EMFFormsViewServiceManager.class); servicesFactory = bundleContext.getService(serviceReference); if (parentContext == null) { for (final Class<?> globalImmediateService : servicesFactory.getAllGlobalImmediateServiceTypes()) { final Optional<?> service = servicesFactory.createGlobalImmediateService(globalImmediateService); serviceMap.put(globalImmediateService, service.get()); } } for (final Class<?> localImmediateService : servicesFactory.getAllLocalImmediateServiceTypes()) { final Optional<?> service = servicesFactory.createLocalImmediateService(localImmediateService); serviceMap.put(localImmediateService, service.get()); } bundleContext.addServiceListener(new ServiceListener() { @Override public void serviceChanged(ServiceEvent event) { if (event.getType() == ServiceEvent.UNREGISTERING && usedOSGiServices.containsKey(event.getServiceReference())) { final Class<?> remove = usedOSGiServices.remove(event.getServiceReference()); serviceMap.remove(remove); } } }); } addResourceIfNecessary(); ViewModelUtil.resolveDomainReferences(getViewModel(), getDomainModel()); viewModelContentAdapter = new ViewModelContentAdapter(); checkAndUpdateSettingToControlMapping(view); view.eAdapters().add(viewModelContentAdapter); if (parentContext == null) { domainModelContentAdapter = new DomainModelContentAdapter(); domainObject.eAdapters().add(domainModelContentAdapter); } readAbstractViewServices(); for (final ViewModelService viewService : viewServices) { if (!GlobalViewModelService.class.isInstance(viewService) || parentContext == null) { viewService.instantiate(this); } } }

Target:
private void instantiate() { final Bundle bundle = FrameworkUtil.getBundle(getClass()); if (bundle != null) { final BundleContext bundleContext = bundle.getBundleContext(); final ServiceReference<EMFFormsLegacyServicesManager> serviceReferenceLegacy = bundleContext .getServiceReference(EMFFormsLegacyServicesManager.class); if (serviceReferenceLegacy != null) { final EMFFormsLegacyServicesManager legacyServicesFactory = bundleContext .getService(serviceReferenceLegacy); legacyServicesFactory.instantiate(); bundleContext.ungetService(serviceReferenceLegacy); } final ServiceReference<EMFFormsViewServiceManager> serviceReference = bundleContext .getServiceReference(EMFFormsViewServiceManager.class); servicesManager = bundleContext.getService(serviceReference); if (parentContext == null) { for (final Class<?> globalImmediateService : servicesManager.getAllGlobalImmediateServiceTypes()) { final Optional<?> service = servicesManager.createGlobalImmediateService(globalImmediateService); serviceMap.put(globalImmediateService, service.get()); } } for (final Class<?> localImmediateService : servicesManager.getAllLocalImmediateServiceTypes()) { final Optional<?> service = servicesManager.createLocalImmediateService(localImmediateService); serviceMap.put(localImmediateService, service.get()); } bundleContext.addServiceListener(new ServiceListener() { @Override public void serviceChanged(ServiceEvent event) { if (event.getType() == ServiceEvent.UNREGISTERING && usedOSGiServices.containsKey(event.getServiceReference())) { final Class<?> remove = usedOSGiServices.remove(event.getServiceReference()); serviceMap.remove(remove); } } }); } addResourceIfNecessary(); ViewModelUtil.resolveDomainReferences(getViewModel(), getDomainModel()); viewModelContentAdapter = new ViewModelContentAdapter(); checkAndUpdateSettingToControlMapping(view); view.eAdapters().add(viewModelContentAdapter); if (parentContext == null) { domainModelContentAdapter = new DomainModelContentAdapter(); domainObject.eAdapters().add(domainModelContentAdapter); } }