Bug 56195 NPE invoking search on working set and then cancelling
I20040325 1. select a method name 2. in the ctx menu select References > Working Set 3. Cancel the working set dialog 4. NPE is in log java.lang.NullPointerException at org.eclipse.search.ui.NewSearchUI.runQuery(NewSearchUI.java:43) at org.eclipse.jdt.ui.actions.FindAction.performNewSearch(FindAction.java:331) at org.eclipse.jdt.ui.actions.FindAction.run(FindAction.java:278) at org.eclipse.jdt.ui.actions.FindAction.run(FindAction.java:246) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.dispatchRun(SelectionDispatchAction.java:216) at org.eclipse.jdt.ui.actions.SelectionDispatchAction.run(SelectionDispatchAction.java:188) at org.eclipse.jface.action.Action.runWithEvent(Action.java:881) at org.eclipse.jface.action.ActionContributionItem.handleWidgetSelection(ActionContributionItem.java:550) at org.eclipse.jface.action.ActionContributionItem.access$2(ActionContributionItem.java:502) at org.eclipse.jface.action.ActionContributionItem$5.handleEvent(ActionContributionItem.java:435) at org.eclipse.swt.widgets.EventTable.sendEvent(EventTable.java:82) at org.eclipse.swt.widgets.Widget.sendEvent(Widget.java:769) at org.eclipse.swt.widgets.Display.runDeferredEvents(Display.java:2584) at org.eclipse.swt.widgets.Display.readAndDispatch(Display.java:2262) at org.eclipse.ui.internal.Workbench.runEventLoop(Workbench.java:1562) at org.eclipse.ui.internal.Workbench.runUI(Workbench.java:1536) at org.eclipse.ui.internal.Workbench.createAndRunWorkbench(Workbench.java:257) at org.eclipse.ui.PlatformUI.createAndRunWorkbench(PlatformUI.java:139) at org.eclipse.ui.internal.ide.IDEApplication.run(IDEApplication.java:90) at org.eclipse.core.internal.runtime.PlatformActivator$1.run(PlatformActivator.java:288) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:232) at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:116) 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:315) at org.eclipse.core.launcher.Main.run(Main.java:740) at org.eclipse.core.launcher.Main.main(Main.java:724)
org.eclipse.jdt.ui/ui/org/eclipse/jdt/ui/actions/FindAction.java
}
			}
			try {
				new ProgressMonitorDialog(shell).run(true, true, op);
			} catch (InvocationTargetException ex) {
				ExceptionHandler.handle(ex, shell, SearchMessages.getString("Search.Error.search.title"), SearchMessages.getString("Search.Error.search.message")); 
			} catch(InterruptedException e) {
				
			} finally {
				if (isAutoBuilding) {
					
					workspaceDesc= JavaPlugin.getWorkspace().getDescription();
					workspaceDesc.setAutoBuilding(true);
					try {
						JavaPlugin.getWorkspace().setDescription(workspaceDesc);
					}
					catch (CoreException ex) {
						ExceptionHandler.handle(ex, shell, SearchMessages.getString("Search.Error.setDescription.title"), SearchMessages.getString("Search.Error.setDescription.message")); 
					}
				}				
			}
		}
	}
	private void performNewSearch(IJavaElement element) throws JavaModelException {
		JavaSearchQuery job= createJob(element);
		NewSearchUI.activateSearchResultView();
		NewSearchUI.runQuery(job);
	}
	protected JavaSearchQuery createJob(IJavaElement element) throws JavaModelException {
		return new JavaSearchQuery(new ElementQuerySpecification(element, getLimitTo(), getScope(element), getScopeDescription(element)));