Bug 309851 [CommonNavigator] Navigating to Project Explorer causes an NPE
Build Identifier: Eclipse 3.6, build I20100406-1034 If the object in Project Explorer's tree does not have associated IWorkbenchAdapter then navigating to Project Explorer causes an NPE. The regression was introduced in the "org.eclipse.ui.navigator.resources.ProjectExplorer" class. Private method "convertElement" attempts to get the IWorkbenchAdapter class from our object in the tree. It then blindly calls "getParent()" without checking if the adapter is returned first, which causes the NPE and breaks navigation. Please take a look at the line "found = wba.getParent(original);". private Object convertElement(Object original) { NavigatorContentService ncs = (NavigatorContentService) getNavigatorContentService(); Object found = ncs.getViewerElementData(original); if (found != null) return original; if (original instanceof IAdaptable) { IAdaptable adaptable = (IAdaptable) original; found = adaptable.getAdapter(IResource.class); if (found != null) return found; IWorkbenchAdapter wba = (IWorkbenchAdapter) adaptable.getAdapter(IWorkbenchAdapter.class); found = wba.getParent(original); if (found != null) return convertElement(found); } return original; } Marking as major because navigation is completely broken for us. Reproducible: Always Steps to Reproduce: 1. Please see the details section. 2. 3.
bundles/org.eclipse.ui.navigator.resources/src/org/eclipse/ui/navigator/resources/ProjectExplorer.java
* @noreference This method is not intended to be referenced by clients.
	 * @since 3.4
	 */
	public void setWorkingSetLabel(String label) {
		workingSetLabel = label;
	}
	/**
	 * @return the working set label
	 * @noreference This method is not intended to be referenced by clients.
	 * @since 3.4
	 */
	public String getWorkingSetLabel() {
		return workingSetLabel;
	}
	/**
	 * <p>
	 * </p>
	 * 
	 * @see org.eclipse.ui.part.ISetSelectionTarget#selectReveal(org.eclipse.jface.viewers.ISelection)
	 * @since 3.4
	 */
	public void selectReveal(ISelection selection) {
		if (getCommonViewer() != null) {
			getCommonViewer().setSelection(convertSelection(selection), true);
		}
	}
	private ISelection convertSelection(ISelection s) {
		if (!(s instanceof IStructuredSelection))
			return s;
		Object[] elements = ((IStructuredSelection) s).toArray();