Bug 304739 [Compatibility] NPEs thrown opening a second workbench window
2010-03-04 15:18:36.046 Log ErrorException while dispatching event org.osgi.service.event.Event [topic=org/eclipse/e4/ui/model/application/ElementContainer/selectedElement/SET] to handler org.eclipse.e4.ui.services.internal.events.UIEventHandler@72527252 java.lang.NullPointerException at org.eclipse.ui.part.PageBookView$4.partVisible(PageBookView.java:1038) at org.eclipse.ui.internal.WorkbenchPage.firePartVisible(WorkbenchPage.java:2411) at org.eclipse.ui.internal.WorkbenchPage.access$8(WorkbenchPage.java:2404) at org.eclipse.ui.internal.WorkbenchPage$E4PartListener.partVisible(WorkbenchPage.java:132) at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.firePartVisible(PartServiceImpl.java:205) at org.eclipse.e4.workbench.ui.internal.PartServiceImpl.access$1(PartServiceImpl.java:203) at org.eclipse.e4.workbench.ui.internal.PartServiceImpl$1.handleEvent(PartServiceImpl.java:93) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:73) at org.eclipse.e4.workbench.ui.internal.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at org.eclipse.e4.ui.model.application.impl.PartStackImpl.setSelectedElement(PartStackImpl.java:138) at org.eclipse.e4.ui.model.application.impl.PartStackImpl.setSelectedElement(PartStackImpl.java:1) at org.eclipse.e4.workbench.ui.renderers.swt.LazyStackRenderer.postProcess(LazyStackRenderer.java:102) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:349) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:395) at org.eclipse.e4.workbench.ui.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:56) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:345) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:395) at org.eclipse.e4.workbench.ui.renderers.swt.SWTPartRenderer.processContents(SWTPartRenderer.java:56) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:345) at org.eclipse.e4.ui.workbench.swt.internal.PartRenderingEngine.createGui(PartRenderingEngine.java:395) at org.eclipse.e4.workbench.ui.renderers.swt.PerspectiveStackRenderer.showTab(PerspectiveStackRenderer.java:99) at org.eclipse.e4.workbench.ui.renderers.swt.LazyStackRenderer$1.handleEvent(LazyStackRenderer.java:65) at org.eclipse.e4.ui.services.internal.events.UIEventHandler.handleEvent(UIEventHandler.java:41) at org.eclipse.equinox.internal.event.EventHandlerWrapper.handleEvent(EventHandlerWrapper.java:188) at org.eclipse.equinox.internal.event.EventHandlerTracker.dispatchEvent(EventHandlerTracker.java:198) at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:227) at org.eclipse.osgi.framework.eventmgr.ListenerQueue.dispatchEventSynchronous(ListenerQueue.java:149) at org.eclipse.equinox.internal.event.EventAdminImpl.dispatchEvent(EventAdminImpl.java:139) at org.eclipse.equinox.internal.event.EventAdminImpl.sendEvent(EventAdminImpl.java:78) at org.eclipse.equinox.internal.event.EventComponent.sendEvent(EventComponent.java:39) at org.eclipse.e4.ui.services.internal.events.EventBroker.send(EventBroker.java:73) at org.eclipse.e4.workbench.ui.internal.UIEventPublisher.notifyChanged(UIEventPublisher.java:58) at org.eclipse.emf.common.notify.impl.BasicNotifierImpl.eNotify(BasicNotifierImpl.java:280) at org.eclipse.e4.ui.model.application.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:138) at org.eclipse.e4.ui.model.application.impl.PerspectiveStackImpl.setSelectedElement(PerspectiveStackImpl.java:1) at org.eclipse.ui.internal.WorkbenchPage.setPerspective(WorkbenchPage.java:1878) at org.eclipse.ui.internal.WorkbenchWindow.initializeDefaultServices(WorkbenchWindow.java:1579) at org.eclipse.ui.internal.WorkbenchWindow.setup(WorkbenchWindow.java:352) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:48) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:37) at java.lang.reflect.Method.invoke(Method.java:600) at org.eclipse.e4.core.services.internal.context.InjectionMethod.callMethod(InjectionMethod.java:96) at org.eclipse.e4.core.services.internal.context.InjectionMethod.invoke(InjectionMethod.java:60) at org.eclipse.e4.core.services.internal.context.InjectionClass.processPostConstruct(InjectionClass.java:67) at org.eclipse.e4.core.services.internal.context.InjectionClass.notify(InjectionClass.java:44) at org.eclipse.e4.core.services.internal.context.EclipseContext$TrackableComputationExt.notify(EclipseContext.java:153) at org.eclipse.e4.core.services.internal.context.EclipseContext.runAndTrack(EclipseContext.java:423) at org.eclipse.e4.core.services.internal.context.ObjectProviderContext.runAndTrack(ObjectProviderContext.java:91) at org.eclipse.e4.core.services.internal.context.ContextInjector.inject(ContextInjector.java:58) at org.eclipse.e4.core.services.injector.Injector.inject(Injector.java:31) at org.eclipse.e4.core.services.internal.context.ObjectProviderContext.init(ObjectProviderContext.java:87) at org.eclipse.e4.core.services.context.spi.ContextInjectionFactory.inject(ContextInjectionFactory.java:94) at org.eclipse.ui.internal.Workbench.createWorkbenchWindow(Workbench.java:1088) at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2009) at org.eclipse.ui.internal.Workbench.openWorkbenchWindow(Workbench.java:2004) at org.eclipse.ui.internal.handlers.OpenInNewWindowHandler.execute(OpenInNewWindowHandler.java:58)
tests/org.eclipse.e4.ui.tests/src/org/eclipse/e4/ui/tests/application/EPartServiceTest.java
application.getChildren().add(window);
		MPartStack partStackA = MApplicationFactory.eINSTANCE.createPartStack();
		MPartStack partStackB = MApplicationFactory.eINSTANCE.createPartStack();
		window.getChildren().add(partStackA);
		window.getChildren().add(partStackB);
		MPart partA1 = MApplicationFactory.eINSTANCE.createPart();
		MPart partA2 = MApplicationFactory.eINSTANCE.createPart();
		partA1.setId("partA1");
		partA2.setId("partA2");
		partStackA.getChildren().add(partA1);
		partStackA.getChildren().add(partA2);
		MPart partB1 = MApplicationFactory.eINSTANCE.createPart();
		MPart partB2 = MApplicationFactory.eINSTANCE.createPart();
		partB1.setId("partB1");
		partB2.setId("partB2");
		partStackB.getChildren().add(partB1);
		partStackB.getChildren().add(partB2);
		partStackA.setSelectedElement(partA1);
		partStackB.setSelectedElement(partB1);
		window.setSelectedElement(partStackA);
		initialize(applicationContext, application);
		getEngine().createGui(window);
		EPartService partService = (EPartService) window.getContext().get(
				EPartService.class.getName());
		partService.activate(partA1);
		assertEquals(partA1, partService.getActivePart());
		MPart shownPart = partService.showPart("partB1",
				EPartService.PartState.VISIBLE);
		assertTrue(partService.isPartVisible(partA1));
		assertTrue(partService.isPartVisible(partB1));