Bug 94562 AFE when switching between editor not on the build path
RC0 I have two editors open on CUs which both aren't on the build path (one from repository, one an a Cu stored in a resource folder). Switch from the one from the repository to the other one using Ctrl+F6 produced the following exception. After getting this exception I now get it whenever I activate the editor. Even close doesn't work anymore since it generates the exception. This happens for the CU stored in the folder not on the build path org.eclipse.jface.util.Assert$AssertionFailedException: null argument; at org.eclipse.jface.util.Assert.isNotNull(Assert.java:149) at org.eclipse.jface.util.Assert.isNotNull(Assert.java:125) at org.eclipse.jface.viewers.StructuredSelection.<init>(StructuredSelection.java:66) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.getAdapter(JavaEditor.java:1859) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.getAdapter(CompilationUnitEditor.java:1933) at org.eclipse.ui.internal.ShowInMenu.getShowInSource(ShowInMenu.java:212) at org.eclipse.ui.internal.ShowInMenu.getContext(ShowInMenu.java:250) at org.eclipse.ui.internal.ShowInMenu.fillMenu(ShowInMenu.java:120) at org.eclipse.ui.internal.ShowInMenu.fill(ShowInMenu.java:95) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:627) at org.eclipse.jface.action.MenuManager.updateAll(MenuManager.java:721) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:646) at org.eclipse.jface.action.MenuManager.updateAll(MenuManager.java:721) at org.eclipse.jface.action.MenuManager.update(MenuManager.java:646) at org.eclipse.jface.action.MenuManager.updateAll(MenuManager.java:721) at org.eclipse.ui.internal.WorkbenchWindow.updateActionBars(WorkbenchWindow.java:2490) at org.eclipse.ui.internal.WorkbenchPage.updateActionBars(WorkbenchPage.java:3164) at org.eclipse.ui.internal.WorkbenchPage$ActionSwitcher.updateActivePart(WorkbenchPage.java:319) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:2742) at org.eclipse.ui.internal.WorkbenchPage.requestActivation(WorkbenchPage.java:2392) at org.eclipse.ui.internal.PartPane.requestActivation(PartPane.java:246) at org.eclipse.ui.internal.PartPane.setFocus(PartPane.java:278) at org.eclipse.ui.internal.PartStack.presentationSelectionChanged(PartStack.java:748) at org.eclipse.ui.internal.PartStack.access$0(PartStack.java:731) at org.eclipse.ui.internal.PartStack$1.selectPart(PartStack.java:115) at org.eclipse.ui.internal.presentations.util.TabbedStackPresentation$1.handleEvent(TabbedStackPresentation.java:126) at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:267) at org.eclipse.ui.internal.presentations.util.AbstractTabFolder.fireEvent(AbstractTabFolder.java:276) at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder.access$1(DefaultTabFolder.java:1) at org.eclipse.ui.internal.presentations.defaultpresentation.DefaultTabFolder$2.handleEvent(DefaultTabFolder.java:80) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:866) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:851) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:659) at org.eclipse.swt.custom.CTabFolder.setSelection(CTabFolder.java:3137) at org.eclipse.swt.custom.CTabFolder.onMouse(CTabFolder.java:1921) at org.eclipse.swt.custom.CTabFolder$1.handleEvent(CTabFolder.java:288) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:842) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2901) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2534) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1601) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1565) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:315) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:143) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:103) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:230) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:345) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:158) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39) at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25) at java.lang.reflect.Method.invoke(Method.java:585) at org.eclipse.core.launcher.Main.invokeFramework(Main.java:328) at org.eclipse.core.launcher.Main.basicRun(Main.java:272) at org.eclipse.core.launcher.Main.run(Main.java:974) at org.eclipse.core.launcher.Main.main(Main.java:950)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/JavaEditor.java
} else if (reference instanceof ILocalVariable) {
					range= ((ILocalVariable)reference).getNameRange();
					if (range != null) {
						offset= range.getOffset();
						length= range.getLength();
					}
				} else if (reference instanceof IImportDeclaration) {
					String name= ((IImportDeclaration) reference).getElementName();
					if (name != null && name.length() > 0) {
						String content= reference.getSource();
						if (content != null) {
							offset= range.getOffset() + content.indexOf(name);
							length= name.length();
						}
					}
				} else if (reference instanceof IPackageDeclaration) {
					String name= ((IPackageDeclaration) reference).getElementName();
					if (name != null && name.length() > 0) {
						String content= reference.getSource();
						if (content != null) {
							offset= range.getOffset() + content.indexOf(name);
							length= name.length();
						}
					}
				}
				if (offset > -1 && length > 0) {
					try  {
						textWidget.setRedraw(false);
						sourceViewer.revealRange(offset, length);
						sourceViewer.setSelectedRange(offset, length);