Source:
public void createLayoutWithThreeContextLayers() { window = BasicFactoryImpl.eINSTANCE.createWindow(); MPerspectiveStack perspectiveStack = MAdvancedFactory.INSTANCE.createPerspectiveStack(); window.getChildren().add(perspectiveStack); perspectiveA = MAdvancedFactory.INSTANCE.createPerspective(); perspectiveB = MAdvancedFactory.INSTANCE.createPerspective(); MPartStack stackA = MBasicFactory.INSTANCE.createPartStack(); partA1 = MBasicFactory.INSTANCE.createPart(); partA2 = MBasicFactory.INSTANCE.createPart(); stackA.getChildren().add(partA1); stackA.getChildren().add(partA2); perspectiveA.getChildren().add(stackA); perspectiveStack.getChildren().add(perspectiveA); MPartStack stackB = MBasicFactory.INSTANCE.createPartStack(); partB1 = MBasicFactory.INSTANCE.createPart(); stackA.getChildren().add(partB1); stackA.setSelectedElement(partB1); perspectiveB.getChildren().add(stackB); perspectiveStack.getChildren().add(perspectiveB); perspectiveStack.setSelectedElement(perspectiveA); stackA.setSelectedElement(partA1); command = CommandsFactoryImpl.eINSTANCE.createCommand(); command.setElementId(COMMANDID); command.setCommandName("Test Handler Activation"); MApplication application = ApplicationFactoryImpl.eINSTANCE.createApplication(); application.getCommands().add(command); application.getChildren().add(window); application.setContext(appContext); appContext.set(MApplication.class.getName(), application); ContextInjectionFactory.make(CommandProcessingAddon.class, appContext); ContextInjectionFactory.make(HandlerProcessingAddon.class, appContext); wb = new E4Workbench(window, appContext); wb.createAndRunUI(window); ECommandService commandService = appContext.get(ECommandService.class); handlerService = appContext.get(EHandlerService.class); parameterizedCommand = commandService.createCommand(COMMANDID, null); partService = appContext.get(EPartService.class); }

Target:
public void createLayoutWithThreeContextLayers() { window = BasicFactoryImpl.eINSTANCE.createWindow(); MPerspectiveStack perspectiveStack = MAdvancedFactory.INSTANCE.createPerspectiveStack(); window.getChildren().add(perspectiveStack); perspectiveA = MAdvancedFactory.INSTANCE.createPerspective(); perspectiveB = MAdvancedFactory.INSTANCE.createPerspective(); MPartStack stackA = MBasicFactory.INSTANCE.createPartStack(); partA1 = MBasicFactory.INSTANCE.createPart(); partA2 = MBasicFactory.INSTANCE.createPart(); stackA.getChildren().add(partA1); stackA.getChildren().add(partA2); perspectiveA.getChildren().add(stackA); perspectiveStack.getChildren().add(perspectiveA); MPartStack stackB = MBasicFactory.INSTANCE.createPartStack(); partB1 = MBasicFactory.INSTANCE.createPart(); stackB.getChildren().add(partB1); stackB.setSelectedElement(partB1); perspectiveB.getChildren().add(stackB); perspectiveStack.getChildren().add(perspectiveB); perspectiveStack.setSelectedElement(perspectiveA); stackA.setSelectedElement(partA1); command = CommandsFactoryImpl.eINSTANCE.createCommand(); command.setElementId(COMMANDID); command.setCommandName("Test Handler Activation"); MApplication application = ApplicationFactoryImpl.eINSTANCE.createApplication(); application.getCommands().add(command); application.getChildren().add(window); application.setContext(appContext); appContext.set(MApplication.class.getName(), application); ContextInjectionFactory.make(CommandProcessingAddon.class, appContext); ContextInjectionFactory.make(HandlerProcessingAddon.class, appContext); wb = new E4Workbench(window, appContext); wb.createAndRunUI(window); ECommandService commandService = appContext.get(ECommandService.class); handlerService = appContext.get(EHandlerService.class); parameterizedCommand = commandService.createCommand(COMMANDID, null); partService = appContext.get(EPartService.class); }