Bug 5232 Java Search page not initialized correctly from Navigator
1. Open the Navigator 2. Select a .java file (that's on the classpath) 3. Open the Search dialog (Ctrl+H) 4. Press Search ==> Nothing found. It should give the same result(s) as if the .java file would be selected in the Packages view.
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java
} else if (o instanceof ISearchResultViewEntry) {
			fJavaElement= getJavaElement(((ISearchResultViewEntry)o).getSelectedMarker());
			result= determineInitValuesFrom(fJavaElement);
		} else if (o instanceof IAdaptable) {
			IWorkbenchAdapter element= (IWorkbenchAdapter)((IAdaptable)o).getAdapter(IWorkbenchAdapter.class);
			if (element != null)
				result= new SearchPatternData(TYPE, REFERENCES, element.getLabel(o), null);
		}
		return result;
	}
	private IJavaElement getJavaElement(IMarker marker) {
		try {
			return JavaCore.create((String)marker.getAttribute(IJavaSearchUIConstants.ATT_JE_HANDLE_ID));
		} catch (CoreException ex) {
			ExceptionHandler.handle(ex, SearchMessages.getString("Search.Error.createJavaElement.title"), SearchMessages.getString("Search.Error.createJavaElement.message")); 
			return null;
		}
	}
	
	private SearchPatternData determineInitValuesFrom(IJavaElement element) {
		if (element == null)
			return null;
		int searchFor= UNKNOWN;
		int limitTo= UNKNOWN;
		String pattern= null; 
		switch (element.getElementType()) {
			case IJavaElement.PACKAGE_FRAGMENT:
				searchFor= PACKAGE;
				limitTo= REFERENCES;
				pattern= element.getElementName();