Bug 11828 Can cause NPE: Open Recent... is active when no perspective is open
1. open 2 java files (A and B) 2. close all perspectives 3. Open Recent... (should be diabled) 4. Open file A 5. Open file B ==> icons appear in the toolbar Click next error ==> NPE Log: Wed Mar 20 14:11:39 GMT+01:00 2002 2 org.eclipse.ui 2 Problems occurred when invoking code from plug-in: org.eclipse.ui. java.lang.NullPointerException at org.eclipse.jdt.internal.ui.text.java.hover.JavaInformationProvider.update(JavaInformationProvider.java:89) at org.eclipse.jdt.internal.ui.text.java.hover.JavaInformationProvider$EditorWatcher.partActivated(JavaInformationProvider.java:54) at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:37) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:817) at org.eclipse.core.runtime.Platform.run(Platform.java:395) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:35) at org.eclipse.ui.internal.WWinPartService.partActivated(WWinPartService.java:102) at org.eclipse.ui.internal.PartListenerList$1.run(PartListenerList.java:37) at org.eclipse.core.internal.runtime.InternalPlatform.run(InternalPlatform.java:817) at org.eclipse.core.runtime.Platform.run(Platform.java:395) at org.eclipse.ui.internal.PartListenerList.firePartActivated(PartListenerList.java:35) at org.eclipse.ui.internal.WorkbenchPage.firePartActivated(WorkbenchPage.java:696) at org.eclipse.ui.internal.WorkbenchPage.setActivePart(WorkbenchPage.java:1683) at org.eclipse.ui.internal.WorkbenchPage.activate(WorkbenchPage.java:103) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1277) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1254) at org.eclipse.ui.internal.WorkbenchPage.openEditor(WorkbenchPage.java:1246) at org.eclipse.ui.internal.ReopenEditorMenu.open(ReopenEditorMenu.java:195) at org.eclipse.ui.internal.ReopenEditorMenu$1.widgetSelected(ReopenEditorMenu.java:163) at org.eclipse.swt.widgets.TypedListener.handleEvent(TypedListener.java:85) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:698) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:196) at org.eclipse.core.launcher.Main.run(Main.java:555) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52) Log: Wed Mar 20 14:11:40 GMT+01:00 2002 1 org.eclipse.core.resources 4 Unhandled exception caught in event loop. Log: Wed Mar 20 14:11:40 GMT+01:00 2002 4 org.eclipse.ui 0 java.lang.NullPointerException java.lang.NullPointerException at org.eclipse.jdt.internal.ui.javaeditor.GotoErrorAction.run(GotoErrorAction.java:32) at org.eclipse.jface.action.Action.runWithEvent(Action.java:473) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:407) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:361) at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:352) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:47) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java(Compiled Code)) at org.eclipse.swt.widgets.Widget.notifyListeners(Widget.java(Compiled Code)) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java(Compiled Code)) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java(Compiled Code)) at org.eclipse.ui.internal.Workbench.run(Workbench.java:698) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:777) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:319) at java.lang.reflect.Method.invoke(Native Method) at org.eclipse.core.launcher.Main.basicRun(Main.java:196) at org.eclipse.core.launcher.Main.run(Main.java:555) at org.eclipse.core.launcher.UIMain.main(UIMain.java:52)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/text/java/hover/JavaInformationProvider.java
fImplementation= new JavaTypeHover();
				fImplementation.setEditor(fEditor);
			}
		}
	}
	
	/*
	 * @see IInformationProvider#getSubject(ITextViewer, int)
	 */
	public IRegion getSubject(ITextViewer textViewer, int offset) {
		
		if (textViewer != null)
			return JavaWordFinder.findWord(textViewer.getDocument(), offset);
		
		return null;	
	}
	/*
	 * @see IInformationProvider#getInformation(ITextViewer, IRegion)
	 */
	public String getInformation(ITextViewer textViewer, IRegion subject) {
		if (fImplementation != null) {
			String s= fImplementation.getHoverInfo(textViewer, subject);
			if (s != null && s.trim().length() > 0)
				return s;
		}
		
		return null;
	}
}