BufferedReader reader= new BufferedReader(new StringReader(((ITextSelection) selection).getText())); String text; try { text= reader.readLine(); if (text == null) text= ""; } catch (IOException ex) { text= "";
String selectionText= ((ITextSelection) selection).getText(); String text= ""; if (selectionText != null && selectionText.length() > 0) { int i= 0; while (i < selectionText.length() && !IndentManipulation.isLineDelimiterChar(selectionText.charAt(i))) { i++; } text= selectionText.substring(0, i);
	private SearchPatternData trySimpleTextSelection(ISelection selection) {		SearchPatternData result= null;		if (selection instanceof ITextSelection) {			BufferedReader reader= new BufferedReader(new StringReader(((ITextSelection) selection).getText()));			String text;			try {				text= reader.readLine();				if (text == null)					text= ""; //$NON-NLS-1$			} catch (IOException ex) {				text= ""; //$NON-NLS-1$			}			result= new SearchPatternData(text, null, ""); //$NON-NLS-1$		}		return result;	}