Bug 10577 Java Search: search scope "Selected resource" not working
Switch to new StructuredSelectionProvider intruduced this bug a) because the provider does not do code resolve if the input is not a selection service b) because at the time the selection service is asked for the selection it takes the selection form the newly opened Search view
org.eclipse.jdt.ui/ui/org/eclipse/jdt/internal/ui/search/JavaSearchPage.java
if (selection instanceof ITextSelection) {
			BufferedReader reader= new BufferedReader(new StringReader(((ITextSelection)selection).getText()));
			String text;
			try {
				text= reader.readLine();
				if (text == null)
					text= ""; 
			} catch (IOException ex) {
				text= ""; 
			}
			result= new SearchPatternData(TYPE, REFERENCES, text, null);
		}
		return result;
	}
	
	private SearchPatternData getDefaultInitValues() {
		return new SearchPatternData(TYPE, REFERENCES, "", null); 
	}	
	/*
	 * Implements method from ISearchPage
	 */
	public void setContainer(ISearchPageContainer container) {
		fContainer= container;
	}
	
	/**
	 * Returns the search page's container.
	 */
	private ISearchPageContainer getContainer() {
		return fContainer;