Bug 7156 Search using previous search from Java Search page's list gives wrong results
1. Search via Java Search page (search dialog) 2. Search for something else 3. Select the first Search from the drop down 4. Search ==> searched for wrong java element
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java
private SearchPatternData tryTypedTextSelection(ISelection selection) {
		if (selection instanceof ITextSelection) {
			IEditorPart e= getEditorPart();
			if (e != null) {
				ITextSelection ts= (ITextSelection)selection;
				ICodeAssist assist= getCodeAssist(e);
				if (assist != null) {
					IJavaElement[] elements= null;
					try {
						elements= assist.codeSelect(ts.getOffset(), ts.getLength());
					} catch (JavaModelException ex) {
						ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createJavaElement.title"), SearchMessages.getString("Search.Error.createJavaElement.message")); 
					}
					if (elements != null && elements.length > 0) {
						IJavaElement javaElement;
						if (elements.length == 1)
							javaElement= elements[0];
						else
							javaElement= chooseFromList(elements);
						if (javaElement != null)
							return determineInitValuesFrom(javaElement);
					}
				}
			}
		}
		return null;
	}
	
	private ICodeAssist getCodeAssist(IEditorPart editorPart) {
		IEditorInput input= editorPart.getEditorInput();