Bug 282875 [UI] Allow parts of models to be rendered
We need to change the rendering protocol to allow a 'createGui' to specify the container it should be created under (in SWT-land this would be a Composite). This is necessary to facilitate unit tests and to allow the ad-hoc rendering of chunks of a model within an arbitrary container (i.e. a Dialog or Wizard). In order to do this we'll have to make an API change to the PartFactory's 'createWidget' so that it will get the parent container as a parameter. In order to 'upgrade' an existing PartFactory you would simply replace the code you're currently using to find the correct container with the new parameter's value.
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/workbench/ui/internal/Workbench.java
public static void initializeRenderer(IExtensionRegistry registry, PartRenderer r,
			IEclipseContext context, IContributionFactory f) {
		
		
		
		IConfigurationElement[] factories = registry
				.getConfigurationElementsFor("org.eclipse.e4.workbench.partfactory"); 
		
		
		int offset = 0;
		for (int i = 0; i < factories.length; i++) {
			String clsSpec = factories[i].getAttribute("class"); 
			if (clsSpec.indexOf("Legacy") >= 0 
					|| clsSpec.indexOf("PartSash") >= 0) { 
				IConfigurationElement tmp = factories[offset];
				factories[offset++] = factories[i];
				factories[i] = tmp;
			}
		}
		for (int i = 0; i < factories.length; i++) {
			PartFactory factory = null;
			try {
				factory = (PartFactory) factories[i].createExecutableExtension("class"); 
			} catch (CoreException e) {
				e.printStackTrace();
			}
			if (factory != null) {
				factory.init(r, context, f);
				ContextInjectionFactory.inject(factory, context);
				r.addPartFactory(factory);