Source:
public AbstractSWTRenderer<VElement> getRendererInstance(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; for (final EMFFormsDIRendererService<VElement> rendererService : diRendererServices) { final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService == null) { return null; } final EMFFormsContextProvider contextProvider = viewModelContext.getService(EMFFormsContextProvider.class); final IEclipseContext eclipseContext = contextProvider.getContext(); final IEclipseContext childContext = eclipseContext.createChild(); childContext.set(ViewModelContext.class, viewModelContext); childContext.set(VElement.class, vElement); final Class<? extends VElement> elementClass = vElement.getClass(); final Class<?>[] elementInterfaces = elementClass.getInterfaces(); for (final Class elementInterface : elementInterfaces) { if (VElement.class.isAssignableFrom(elementInterface)) { childContext.set(elementInterface, elementInterface.cast(vElement)); } } final Class<? extends AbstractSWTRenderer<VElement>> rendererClass = bestRendererService.getRendererClass(); final AbstractSWTRenderer<VElement> rendererInstance = ContextInjectionFactory .make(rendererClass, childContext); return rendererInstance; }

Target:
public AbstractSWTRenderer<VElement> getRendererInstance(VElement vElement, ViewModelContext viewModelContext) { double highestPriority = Double.MIN_VALUE; EMFFormsDIRendererService<VElement> bestRendererService = null; final Set<EMFFormsDIRendererService<VElement>> rendererServicesCopy = new LinkedHashSet<EMFFormsDIRendererService<VElement>>( diRendererServices); for (final EMFFormsDIRendererService<VElement> rendererService : rendererServicesCopy) { final double isCurrentApplicable = rendererService.isApplicable(vElement, viewModelContext); if (!Double.isNaN(isCurrentApplicable) && isCurrentApplicable > highestPriority) { highestPriority = isCurrentApplicable; bestRendererService = rendererService; } } if (bestRendererService == null) { return null; } final EMFFormsContextProvider contextProvider = viewModelContext.getService(EMFFormsContextProvider.class); if (contextProvider == null) { reportService .report(new AbstractReport( "The given ViewModelContext does not have a EMFFormsContextProvider. Hence, no renderer instance can be created.")); return null; } final IEclipseContext eclipseContext = contextProvider.getContext(); final IEclipseContext childContext = eclipseContext.createChild(); childContext.set(ViewModelContext.class, viewModelContext); childContext.set(VElement.class, vElement); final Class<? extends VElement> elementClass = vElement.getClass(); final Class<?>[] elementInterfaces = elementClass.getInterfaces(); for (final Class elementInterface : elementInterfaces) { if (VElement.class.isAssignableFrom(elementInterface)) { childContext.set(elementInterface, elementInterface.cast(vElement)); } } final Class<? extends AbstractSWTRenderer<VElement>> rendererClass = bestRendererService.getRendererClass(); final AbstractSWTRenderer<VElement> rendererInstance; try { rendererInstance = ContextInjectionFactory.make(rendererClass, childContext); } catch (@SuppressWarnings("restriction") final org.eclipse.e4.core.di.InjectionException ex) { reportService.report(new AbstractReport(ex)); return null; } return rendererInstance; }