Bug 25729 Java editor opening up build.xml
Using Java editor to open .xml usually works. But when opening Ant build file (build.xml), it gives the NullPointerException and the IDE no longer works. !ENTRY org.eclipse.ui 4 4 Nov 05, 2002 09:28:39.131 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Nov 05, 2002 09:28:39.131 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.ui.internal.WorkbenchWindow$12.shellActivated(WorkbenchWindow. java:1454) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:157) 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:830) at org.eclipse.swt.widgets.Decorations.WM_ACTIVATE (Decorations.java:1246) at org.eclipse.swt.widgets.Shell.WM_ACTIVATE(Shell.java:1139) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2689) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DestroyWindow(Native Method) at org.eclipse.swt.widgets.Control.destroyWidget(Control.java:497) at org.eclipse.swt.widgets.Widget.dispose(Widget.java:358) at org.eclipse.swt.widgets.Shell.dispose(Shell.java:470) at org.eclipse.jface.window.Window.close(Window.java:223) at org.eclipse.jface.dialogs.Dialog.close(Dialog.java:676) at org.eclipse.jface.dialogs.MessageDialog.buttonPressed(MessageDialog.java:1 41) at org.eclipse.jface.dialogs.Dialog$1.widgetSelected(Dialog.java:397) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:87) 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.jface.window.Window.runEventLoop(Window.java:561) at org.eclipse.jface.window.Window.open(Window.java:541) at org.eclipse.jface.dialogs.MessageDialog.openQuestion(MessageDialog.java:31 8) at org.eclipse.ui.internal.Workbench$1.handleException(Workbench.java:222) at org.eclipse.core.internal.runtime.InternalPlatform.handleException(Interna lPlatform.java:439) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.ja va:841) at org.eclipse.core.runtime.Platform.run(Platform.java:413) at org.eclipse.ui.internal.Workbench.busyClose(Workbench.java:208) at org.eclipse.ui.internal.Workbench.access$5(Workbench.java:206) at org.eclipse.ui.internal.Workbench$4.run(Workbench.java:363) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.Workbench.close(Workbench.java:361) at org.eclipse.ui.internal.Workbench.close(Workbench.java:353) at org.eclipse.ui.internal.Workbench.close(Workbench.java:347) at org.eclipse.ui.internal.WorkbenchWindow.busyClose(WorkbenchWindow.java:355 ) at org.eclipse.ui.internal.WorkbenchWindow.access$3(WorkbenchWindow.java:348) at org.eclipse.ui.internal.WorkbenchWindow$2.run(WorkbenchWindow.java:404) at org.eclipse.swt.custom.BusyIndicator.showWhile(BusyIndicator.java:65) at org.eclipse.ui.internal.WorkbenchWindow.close(WorkbenchWindow.java:402) at org.eclipse.jface.window.Window.handleShellCloseEvent (Window.java:482) at org.eclipse.jface.window.Window$2.shellClosed(Window.java:433) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:152) 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.Decorations.WM_CLOSE(Decorations.java:1258) at org.eclipse.swt.widgets.Shell.WM_CLOSE(Shell.java:1148) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2692) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DefWindowProcW(Native Method) at org.eclipse.swt.internal.win32.OS.DefWindowProc(OS.java:1281) at org.eclipse.swt.widgets.Scrollable.callWindowProc(Scrollable.java:73) at org.eclipse.swt.widgets.Shell.callWindowProc(Shell.java:392) at org.eclipse.swt.widgets.Control.windowProc(Control.java:2766) at org.eclipse.swt.widgets.Decorations.windowProc(Decorations.java:1218) at org.eclipse.swt.widgets.Display.windowProc(Display.java:2172) at org.eclipse.swt.internal.win32.OS.DispatchMessageW(Native Method) at org.eclipse.swt.internal.win32.OS.DispatchMessage(OS.java:1286) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1408) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1419) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1402) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.j ava:831) 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(DelegatingMethodAccessorIm pl.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/JavaEditor.java
}
			
		} else if (moveCursor) {
			resetHighlightRange();
		}
		
		markInNavigationHistory();
	}
		
	public void setSelection(IJavaElement element) {
		
		if (element == null || element instanceof ICompilationUnit || element instanceof IClassFile) {
			/*
			 * If the element is an ICompilationUnit this unit is either the input
			 * of this editor or not being displayed. In both cases, nothing should
			 * happened. (http://dev.eclipse.org/bugs/show_bug.cgi?id=5128)
			 */
			return;
		}
		
		IJavaElement corresponding= getCorrespondingElement(element);
		if (corresponding instanceof ISourceReference) {
			ISourceReference reference= (ISourceReference) corresponding;
			
			setSelection(reference, true);
			
			if (fOutlinePage != null) {
				fOutlinePage.removeSelectionChangedListener(fSelectionChangedListener);
				fOutlinePage.select(reference);
				fOutlinePage.addSelectionChangedListener(fSelectionChangedListener);