Bug 61699 NPE When searching without text selection
I-2004-05-11 I had a case where the I had a NPE in JavaSearchPage.trySimpleTextSelection. Inspection of the code revealed that ITextSelection.getText() can return null, but we're not checking the condition.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java
case ISearchPageContainer.SELECTED_PROJECTS_SCOPE:
				scope= JavaSearchScopeFactory.getInstance().createJavaProjectSearchScope(fStructuredSelection, includeJRE);
				IProject[] projects= JavaSearchScopeFactory.getInstance().getProjects(scope);
				if (projects.length > 1)
					scopeDescription= SearchMessages.getFormattedString("EnclosingProjectsScope", projects[0].getName()); 
				else if (projects.length == 1)
					scopeDescription= SearchMessages.getFormattedString("EnclosingProjectScope", projects[0].getName()); 
				else 
					scopeDescription= SearchMessages.getFormattedString("EnclosingProjectScope", ""); 
				break;
			case ISearchPageContainer.WORKING_SET_SCOPE:
				IWorkingSet[] workingSets= getContainer().getSelectedWorkingSets();
				
				if (workingSets == null || workingSets.length < 1)
					return false;
				scopeDescription= SearchMessages.getFormattedString("WorkingSetScope", SearchUtil.toString(workingSets)); 
				scope= JavaSearchScopeFactory.getInstance().createJavaSearchScope(getContainer().getSelectedWorkingSets(), includeJRE);
				SearchUtil.updateLRUWorkingSets(getContainer().getSelectedWorkingSets());
		}
		
		JavaSearchResultCollector collector= new JavaSearchResultCollector();
		JavaSearchOperation op= null;
		if (data.getJavaElement() != null && getPattern().equals(fInitialData.getPattern())) {
			op= new JavaSearchOperation(workspace, data.getJavaElement(), data.getLimitTo(), scope, scopeDescription, collector);
			if (data.getLimitTo() == IJavaSearchConstants.REFERENCES)
				SearchUtil.warnIfBinaryConstant(data.getJavaElement(), getShell());
		} else {
			data.setJavaElement(null);
			op= new JavaSearchOperation(workspace, data.getPattern(), data.isCaseSensitive(), data.getSearchFor(), data.getLimitTo(), scope, scopeDescription, collector);
		}