Bug 25126 Cannot open cu outside classpath
Build 20021018 + latest jdt core 1. Create Java project 'P' with 'src' source folder 2. Create file P/X.java Observe: You get the following exception: Java Model Exception: Java Model Status [ does not exist.] at org.eclipse.jdt.internal.core.JavaElement.newNotPresentException (JavaElement.java:489) at org.eclipse.jdt.internal.core.PackageFragmentRoot.getUnderlyingResource (PackageFragmentRoot.java:299) at org.eclipse.jdt.internal.core.PackageFragment.getUnderlyingResource (PackageFragment.java:247) at org.eclipse.jdt.internal.core.Openable.getUnderlyingResource (Openable.java:235) at org.eclipse.jdt.internal.core.CompilationUnit.getCorrespondingResource (CompilationUnit.java:391) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider$BufferFac tory.createBuffer(CompilationUnitDocumentProvid at org.eclipse.jdt.internal.core.WorkingCopy.openBuffer (WorkingCopy.java:355) at org.eclipse.jdt.internal.core.Openable.getBuffer(Openable.java:192) at org.eclipse.jdt.internal.core.CompilationUnit.getContents (CompilationUnit.java:374) at org.eclipse.jdt.internal.compiler.parser.Parser.parse (Parser.java:7048) at org.eclipse.jdt.internal.compiler.SourceElementParser.parseCompilationUnit (SourceElementParser.java:1047) at org.eclipse.jdt.internal.core.CompilationUnit.generateInfos (CompilationUnit.java:330) at org.eclipse.jdt.internal.core.CompilationUnit.buildStructure (CompilationUnit.java:84) at org.eclipse.jdt.internal.core.Openable.openWhenClosed (Openable.java:395) at org.eclipse.jdt.internal.core.Openable.open(Openable.java:346) at org.eclipse.jdt.internal.core.WorkingCopy.open(WorkingCopy.java:344) at org.eclipse.jdt.internal.core.CompilationUnit.getWorkingCopy (CompilationUnit.java:609) at org.eclipse.jdt.internal.core.CompilationUnit.getSharedWorkingCopy (CompilationUnit.java:581) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitDocumentProvider.createEle mentInfo(CompilationUnitDocumentProvider.java:8 at org.eclipse.ui.texteditor.AbstractDocumentProvider.connect (AbstractDocumentProvider.java:297) at org.eclipse.ui.texteditor.AbstractTextEditor.doSetInput (AbstractTextEditor.java:2086) at org.eclipse.ui.texteditor.StatusTextEditor.doSetInput (StatusTextEditor.java:160) at org.eclipse.jdt.internal.ui.javaeditor.JavaEditor.doSetInput (JavaEditor.java:561) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.doSetInput (CompilationUnitEditor.java:1016) at org.eclipse.ui.texteditor.AbstractTextEditor.init (AbstractTextEditor.java:1687) at org.eclipse.ui.internal.EditorManager.createSite (EditorManager.java:562) at org.eclipse.ui.internal.EditorManager.openInternalEditor (EditorManager.java:612) at org.eclipse.ui.internal.EditorManager.openEditorFromDescriptor (EditorManager.java:427) at org.eclipse.ui.internal.EditorManager.openEditorFromInput (EditorManager.java:304) at org.eclipse.ui.internal.EditorManager.openEditor (EditorManager.java:392) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1757) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1643) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:129) at org.eclipse.jdt.internal.ui.javaeditor.EditorUtility.openInEditor (EditorUtility.java:102) at org.eclipse.jdt.internal.ui.actions.OpenActionUtil.open (OpenActionUtil.java:47) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:164) at org.eclipse.jdt.ui.actions.OpenAction.run(OpenAction.java:153) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun (SelectionDispatchAction.java:191) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run (SelectionDispatchAction.java:169) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerActionGroup.handleOpen (PackageExplorerActionGroup.java:317) at org.eclipse.jdt.internal.ui.packageview.PackageExplorerPart$5.open (PackageExplorerPart.java:292) at org.eclipse.jface.viewers.StructuredViewer.fireOpen (StructuredViewer.java:320) at org.eclipse.jface.viewers.StructuredViewer.handleOpen (StructuredViewer.java:494) at org.eclipse.jface.viewers.StructuredViewer$3.handleOpen (StructuredViewer.java:581) at org.eclipse.jface.util.OpenStrategy.fireOpenEvent (OpenStrategy.java:204) at org.eclipse.jface.util.OpenStrategy.access$2(OpenStrategy.java:199) at org.eclipse.jface.util.OpenStrategy$1.mouseSelectItem (OpenStrategy.java:338) at org.eclipse.jface.util.OpenStrategy$1.handleEvent (OpenStrategy.java:283) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:833) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1622) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1368) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1420) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1403) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:775) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:462) 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:324) at org.eclipse.core.launcher.Main.basicRun(Main.java:247) at org.eclipse.core.launcher.Main.run(Main.java:703) at org.eclipse.core.launcher.Main.main(Main.java:539)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/javaeditor/CompilationUnitDocumentProvider.java
/*
	 * @see AbstractDocumentProvider#resetDocument(Object)
	 */
	public void resetDocument(Object element) throws CoreException {
		if (element == null)
			return;
			
		ElementInfo elementInfo= getElementInfo(element);		
		if (elementInfo instanceof CompilationUnitInfo) {
			CompilationUnitInfo info= (CompilationUnitInfo) elementInfo;
			
			IDocument document;
			IStatus status= null;
			
			try {
				
				ICompilationUnit original= (ICompilationUnit) info.fCopy.getOriginalElement();
				IResource resource= original.getUnderlyingResource();
				if (resource instanceof IFile) {
					
					IFile file= (IFile) resource;
					IProgressMonitor monitor= new NullProgressMonitor();
					
					try {
						
						file.refreshLocal(IResource.DEPTH_INFINITE, monitor);
					} catch (CoreException x) {
						handleCoreException(x, JavaEditorMessages.getString("CompilationUnitDocumentProvider.error.resetDocument")); 
					}