Bug 27223 Search: NPE in goto marker action
!ENTRY org.eclipse.ui 4 4 Nov 27, 2002 11:44:06.250 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Nov 27, 2002 11:44:06.265 !MESSAGE Argument not valid !STACK 0 java.lang.IllegalArgumentException: Argument not valid at org.eclipse.swt.SWT.error(SWT.java:2166) at org.eclipse.swt.SWT.error(SWT.java:2110) at org.eclipse.swt.custom.StyledText.setCaretOffset(StyledText.java:6880) at org.eclipse.jface.text.TextViewer.handleVerifyEvent(TextViewer.java:2651) at org.eclipse.jface.text.TextViewer$TextVerifyListener.verifyText(TextViewer.java:317) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:187) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:850) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:834) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java:641) at org.eclipse.swt.custom.StyledText.modifyContent(StyledText.java:5597) at org.eclipse.swt.custom.StyledText.sendKeyEvent(StyledText.java:6577) at org.eclipse.swt.custom.StyledText.doContent(StyledText.java:2663) at org.eclipse.swt.custom.StyledText.handleKey(StyledText.java:5023) at org.eclipse.swt.custom.StyledText.handleKeyDown(StyledText.java:5046) at org.eclipse.swt.custom.StyledText$8.handleEvent(StyledText.java:4811) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:77) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:825) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1692) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1410) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1370) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1353) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:841) 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/search/GotoMarkerAction.java
}
	private boolean isPinned(IEditorPart editor) {
		if (editor == null)
			return false;
		
		IEditorReference[] editorRefs= editor.getEditorSite().getPage().getEditorReferences();
		int i= 0;
		while (i < editorRefs.length) {
			if (editor.equals(editorRefs[i].getEditor(false)))
				return editorRefs[i].isPinned();
			i++;
		}
		return false;
	}
	
	private void showInEditor(IMarker marker, IWorkbenchPage page, IEditorInput input, String editorId) {
		IEditorPart editor= page.findEditor(input);
		if (editor == null) {
			if (fEditor != null && !fEditor.isDirty() && !isPinned(fEditor))
				page.closeEditor(fEditor, false);
				try {
					editor= page.openEditor(input, editorId, false);
				} catch (PartInitException ex) {
					MessageDialog.openError(SearchPlugin.getActiveWorkbenchShell(), SearchMessages.getString("Search.Error.openEditor.title"), SearchMessages.getString("Search.Error.openEditor.message")); 
					return;
				}
		} else {
			page.bringToTop(editor);
		}
		if (editor != null) {