Project: Eclipse_Platform_UI
Bug 402781 [API] Extend the EModelService to provide factory capabilities for model elements
Reported: 2013-03-08 14:35:56 | Status: verified fixed

We need to move away from exposing the EMF factory pattern. The obvious replacement is to extend the EModelService. Rather than implementing 'n' discreet methods (one for each concrete class) we'll just implement a generic factory capable of taking a class and (if possible) returning an instance of that class: MPartStack newStack = modelService.createUIElement(MPartStack.class); This has the advantage of allowing us to add new element types (or even deprecate others) without having to modify the API itself.

Files changed in fix:
bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/internal/workbench/ModelServiceImpl.java bundles/org.eclipse.e4.ui.workbench/src/org/eclipse/e4/ui/workbench/modeling/EModelService.java