Bug 36683 NullPointerException doing search [search]
While searching from a file in the Java Browsing Perspecive, I got the following: !SESSION Apr 20, 2003 17:55:58.749 --------------------------------------------- java.version=1.4.1_01 java.vendor=Sun Microsystems Inc. BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US Command-line arguments: -os linux -ws gtk -arch x86 -data /home/dgeg/eclipseWorkspaceBinary -install file:/usr/share/eclipse/ !ENTRY org.eclipse.ui 4 4 Apr 20, 2003 17:55:58.753 !MESSAGE Unhandled exception caught in event loop. !ENTRY org.eclipse.ui 4 0 Apr 20, 2003 17:55:58.763 !MESSAGE java.lang.NullPointerException !STACK 0 java.lang.NullPointerException at org.eclipse.jdt.ui.actions.FindAction.getType(FindAction.java:332) at org.eclipse.jdt.ui.actions.FindAction.makeOperation(FindAction.java:312) at org.eclipse.jdt.ui.actions.FindAction.run(FindAction.java:272) at org.eclipse.jdt.ui.actions.FindReferencesAction.run(FindReferencesAction.java:83) at org.eclipse.jdt.ui.actions.FindAction.run(FindAction.java:238) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:193) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:169) at org.eclipse.jface.action.Action.runWithEvent(Action.java:842) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:456) at org.eclipse.jface.action.ActionContributionItem.handleWidgetEvent(ActionContributionItem.java:403) at org.eclipse.jface.action.ActionContributionItem.access$0(ActionContributionItem.java:397) at org.eclipse.jface.action.ActionContributionItem$ActionListener.handleEvent(ActionContributionItem.java:72) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:81) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:913) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:1637) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:1429) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1402) at org.eclipse.ui.internal.Workbench.run(Workbench.java:1385) at org.eclipse.core.internal.boot.InternalBootLoader.run(InternalBootLoader.java:845) at org.eclipse.core.boot.BootLoader.run(BootLoader.java:461) 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:291) at org.eclipse.core.launcher.Main.run(Main.java:747) at org.eclipse.core.launcher.Main.main(Main.java:583)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindAction.java
private Class[] fValidTypes;
	private JavaEditor fEditor;	
	FindAction(IWorkbenchSite site, String label, Class[] validTypes) {
		super(site);
		setText(label);
		fValidTypes= validTypes;
	}
	FindAction(JavaEditor editor, String label, Class[] validTypes) {
		this (editor.getEditorSite(), label, validTypes);
		fEditor= editor;
		setEnabled(SelectionConverter.canOperateOn(fEditor));
	}
	private boolean canOperateOn(IStructuredSelection sel) {
		return sel != null && !sel.isEmpty() && canOperateOn(getJavaElement(sel, true));
	}
		
	boolean canOperateOn(IJavaElement element) {
		if (fValidTypes == null || fValidTypes.length == 0)
			return false;
		if (element != null) {
			for (int i= 0; i < fValidTypes.length; i++) {
				if (fValidTypes[i].isInstance(element)) {
					if (element.getElementType() == IJavaElement.PACKAGE_FRAGMENT)
						return hasChildren((IPackageFragment)element);
					else
						return true;
				}
			}
		}
		return false;