Bug 322368 Sole part in a part stack shown by EPS should be set as the selected element
SSIA
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/HeadlessContextPresentationEngine.java
private static void populateModelInterfaces(MContext contextModel,
			IEclipseContext context, Class<?>[] interfaces) {
		for (Class<?> intf : interfaces) {
			Activator.trace(Policy.DEBUG_CONTEXTS,
					"Adding " + intf.getName() + " for " 
							+ contextModel.getClass().getName(), null);
			context.set(intf.getName(), contextModel);
			populateModelInterfaces(contextModel, context, intf.getInterfaces());
		}
	}
	@PostConstruct
	void postConstruct() {
		childHandler = new EventHandler() {
			public void handleEvent(Event event) {
				if (UIEvents.EventTypes.ADD.equals(event
						.getProperty(UIEvents.EventTags.TYPE))) {
					Object element = event
							.getProperty(UIEvents.EventTags.NEW_VALUE);
					if (element instanceof MUIElement) {
						Object parent = event
								.getProperty(UIEvents.EventTags.ELEMENT);
						createGui((MUIElement) element, parent,
								getParentContext((MUIElement) element));
						if (parent instanceof MPartStack) {
							MPartStack stack = (MPartStack) parent;
							List<MStackElement> children = stack.getChildren();
							if (children.size() == 1) {
								stack.setSelectedElement((MStackElement) element);
							}
						}