Bug 329918 NPE thrown when activating a part after resetting a perspective without an editor area and the last active part was in the area
1. Open a perspective without an editor area. 2. Open a file. 3. The editor is now active. 4. Window > Reset Perspective... > OK 5. Try to activate a view. An NPE is thrown. Caused by: java.lang.NullPointerException at org.eclipse.e4.ui.workbench.renderers.swt.SWTPartRenderer.setCSSInfo(SWTPartRenderer.java:68) at org.eclipse.e4.ui.workbench.renderers.swt.WBWRenderer.trackActivePart(WBWRenderer.java:131) at sun.reflect.GeneratedMethodAccessor13.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.lang.reflect.Method.invoke(Method.java:618) at org.eclipse.e4.core.internal.di.MethodRequestor.execute(MethodRequestor.java:52) ... 53 more
bundles/org.eclipse.e4.ui.workbench.renderers.swt/src/org/eclipse/e4/ui/workbench/renderers/swt/ElementReferenceRenderer.java
if (refCtrl != null && !refCtrl.isDisposed()
					&& refElement.getCurSharedRef() == ph) {
				
				for (MPlaceholder aPH : refs) {
					Composite phComp = (Composite) aPH.getWidget();
					if (phComp == null || phComp.isDisposed())
						continue;
					
					IEclipseContext newParentContext = modelService
							.getContainingContext(aPH);
					List<MContext> allContexts = modelService.findElements(
							refElement, null, MContext.class, null);
					for (MContext ctxtElement : allContexts) {
						IEclipseContext theContext = ctxtElement.getContext();
						
						if (theContext != null) {
							if (theContext.getParent() == curContext)
								theContext.setParent(newParentContext);
						}
					}
					
					refCtrl.setParent(phComp);
					break;
				}
			}
		}
		super.disposeWidget(element);
	}
}