Bug 15152 Java Editor no longer displays external source
When I set a source lookup path to lookup source for a Junit test in "junit3.7src.zip", the java editor is not properly created: To recreate: (1) Create a launch config for "VectorTests" (2) On the "Source" tab of the launch config, remove the "JUnit" project and add an external jar. Select "junit3.7src.zip" in the file system. (3) Debug to a breakpoint - get the following error: !MESSAGE Problems occurred when invoking code from plug-in: org.eclipse.ui. !STACK java.lang.NullPointerException at org.eclipse.jdt.internal.corext.util.JavaModelUtil.isEditable (JavaModelUtil.java:461) at org.eclipse.jdt.ui.actions.OrganizeImportsAction.selectionChanged (OrganizeImportsAction.java:114) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchSelectionChanged (SelectionDispatchAction.java:125) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.update (SelectionDispatchAction.java:118) at org.eclipse.jdt.ui.actions.GenerateActionGroup.<init> (GenerateActionGroup.java:74) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.createActions (CompilationUnitEditor.java:500) at org.eclipse.ui.texteditor.AbstractTextEditor.createPartControl (AbstractTextEditor.java:1265) at org.eclipse.jdt.internal.ui.javaeditor.CompilationUnitEditor.createPartControl (CompilationUnitEditor.java:1105) at org.eclipse.ui.internal.PartPane$4.run(PartPane.java:128) at org.eclipse.core.internal.runtime.InternalPlatform.run (InternalPlatform.java:791) at org.eclipse.core.runtime.Platform.run(Platform.java:411) at org.eclipse.ui.internal.PartPane.createChildControl (PartPane.java:126) at org.eclipse.ui.internal.PartPane.createControl(PartPane.java:168) at org.eclipse.ui.internal.EditorWorkbook.createPage (EditorWorkbook.java:229) at org.eclipse.ui.internal.EditorWorkbook.add(EditorWorkbook.java:84) at org.eclipse.ui.internal.EditorArea.addEditor(EditorArea.java:43) at org.eclipse.ui.internal.EditorPresentation.openEditor (EditorPresentation.java:309) at org.eclipse.ui.internal.EditorManager$2.run(EditorManager.java:468) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:56) at org.eclipse.ui.internal.EditorManager.openInternalEditor (EditorManager.java:460) at org.eclipse.ui.internal.EditorManager.openInternalEditor (EditorManager.java:529) at org.eclipse.ui.internal.EditorManager.openEditor (EditorManager.java:361) at org.eclipse.ui.internal.EditorManager.openEditor (EditorManager.java:264) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1617) at org.eclipse.ui.internal.WorkbenchPage.openEditor (WorkbenchPage.java:1587) at org.eclipse.debug.internal.ui.views.LaunchView.openEditor (LaunchView.java:589) at org.eclipse.debug.internal.ui.views.LaunchView.openEditorAndSetMarker (LaunchView.java:564) at org.eclipse.debug.internal.ui.views.LaunchView.showMarkerForCurrentSelection (LaunchView.java:458) at org.eclipse.debug.internal.ui.views.LaunchView.selectionChanged (LaunchView.java:295) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:147) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1064) at org.eclipse.jface.viewers.StructuredViewer.setSelection (StructuredViewer.java:813) at org.eclipse.debug.internal.ui.views.LaunchView.autoExpand (LaunchView.java:729) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleSuspendThread Event(LaunchViewEventHandler.java:220) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleSuspendEvent (LaunchViewEventHandler.java:175) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleDebugEvents (LaunchViewEventHandler.java:95) at org.eclipse.debug.internal.ui.views.AbstractDebugEventHandler$1.run (AbstractDebugEventHandler.java:49) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:29) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:93) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1389) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1211) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:883) at org.eclipse.ui.internal.Workbench.run(Workbench.java:866) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:733) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16) !ENTRY org.eclipse.core.resources 1 4 Thu May 02 16:45:57 CDT 2002 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Thu May 02 16:45:57 CDT 2002 !MESSAGE Failed to execute runnable (java.lang.NullPointerException) !STACK org.eclipse.swt.SWTException: Failed to execute runnable (java.lang.NullPointerException) at org.eclipse.swt.SWT.error(SWT.java:1887) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:96) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1389) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1211) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:883) at org.eclipse.ui.internal.Workbench.run(Workbench.java:866) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:733) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16) !ENTRY org.eclipse.core.resources 1 4 Thu May 02 16:45:57 CDT 2002 !MESSAGE *** Stack trace of contained exception *** !ENTRY org.eclipse.ui 4 0 Thu May 02 16:45:57 CDT 2002 !MESSAGE java.lang.NullPointerException !STACK java.lang.NullPointerException at org.eclipse.ui.texteditor.AbstractTextEditor.selectAndReveal (AbstractTextEditor.java:2749) at org.eclipse.ui.texteditor.AbstractTextEditor.gotoMarker (AbstractTextEditor.java:2633) at org.eclipse.debug.internal.ui.views.LaunchView.openEditorAndSetMarker (LaunchView.java:583) at org.eclipse.debug.internal.ui.views.LaunchView.showMarkerForCurrentSelection (LaunchView.java:458) at org.eclipse.debug.internal.ui.views.LaunchView.selectionChanged (LaunchView.java:295) at org.eclipse.jface.viewers.Viewer.fireSelectionChanged (Viewer.java:147) at org.eclipse.jface.viewers.StructuredViewer.updateSelection (StructuredViewer.java:1064) at org.eclipse.jface.viewers.StructuredViewer.setSelection (StructuredViewer.java:813) at org.eclipse.debug.internal.ui.views.LaunchView.autoExpand (LaunchView.java:729) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleSuspendThread Event(LaunchViewEventHandler.java:220) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleSuspendEvent (LaunchViewEventHandler.java:175) at org.eclipse.debug.internal.ui.views.LaunchViewEventHandler.doHandleDebugEvents (LaunchViewEventHandler.java:95) at org.eclipse.debug.internal.ui.views.AbstractDebugEventHandler$1.run (AbstractDebugEventHandler.java:49) at org.eclipse.swt.widgets.RunnableLock.run(RunnableLock.java:29) at org.eclipse.swt.widgets.Synchronizer.runAsyncMessages (Synchronizer.java:93) at org.eclipse.swt.widgets.Display.runAsyncMessages(Display.java:1389) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1211) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:883) at org.eclipse.ui.internal.Workbench.run(Workbench.java:866) at org.eclipse.core.internal.boot.InternalBootLoader.run (InternalBootLoader.java:733) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at EclipseRuntimeLauncher.main(EclipseRuntimeLauncher.java:16)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/OrganizeImportsAction.java
import org.eclipse.ui.IEditorPart;
import org.eclipse.ui.IObjectActionDelegate;
import org.eclipse.ui.IWorkbenchPart;
import org.eclipse.ui.IWorkbenchSite;
import org.eclipse.ui.help.WorkbenchHelp;
import org.eclipse.ui.part.EditorActionBarContributor;
import org.eclipse.jdt.core.ICompilationUnit;
import org.eclipse.jdt.core.IJavaElement;
import org.eclipse.jdt.core.IPackageFragment;
import org.eclipse.jdt.core.ISourceRange;
import org.eclipse.jdt.core.JavaModelException;
import org.eclipse.jdt.ui.IWorkingCopyManager;
import org.eclipse.jdt.ui.JavaUI;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation;
import org.eclipse.jdt.internal.corext.codemanipulation.OrganizeImportsOperation.IChooseImportQuery;
import org.eclipse.jdt.internal.corext.util.JavaModelUtil;
import org.eclipse.jdt.internal.corext.util.TypeInfo;
import org.eclipse.jdt.internal.ui.IJavaHelpContextIds;
import org.eclipse.jdt.internal.ui.JavaPlugin;
import org.eclipse.jdt.internal.ui.actions.ActionMessages;
import org.eclipse.jdt.internal.ui.actions.WorkbenchRunnableAdapter;
import org.eclipse.jdt.internal.ui.dialogs.MultiElementListSelectionDialog;
import org.eclipse.jdt.internal.ui.dialogs.ProblemDialog;
import org.eclipse.jdt.internal.ui.javaeditor.EditorUtility;
import org.eclipse.jdt.internal.ui.javaeditor.JavaEditor;
import org.eclipse.jdt.internal.ui.preferences.ImportOrganizePreferencePage;
import org.eclipse.jdt.internal.ui.util.BusyIndicatorRunnableContext;
import org.eclipse.jdt.internal.ui.util.ExceptionHandler;
import org.eclipse.jdt.internal.ui.util.TypeInfoLabelProvider;
public class OrganizeImportsAction extends SelectionDispatchAction {