int i; for (i= text.length(); i >= 1; i--) { if (!Character.isWhitespace(text.charAt(i-1))) break;
resultOffset= line.getOffset() + text.length();  try {  ITypedRegion partition= document.getPartition(resultOffset); while (!IDocument.DEFAULT_CONTENT_TYPE.equals(partition.getType())) { resultOffset= partition.getOffset() -1; if (resultOffset <= startOffset) return startOffset; partition= document.getPartition(resultOffset); }  while (resultOffset -1 > startOffset && Character.isWhitespace(document.getChar(resultOffset -1))) -- resultOffset;  } catch (BadLocationException e) { return startOffset;
	protected int computeCharacterPosition(ITextSelection line, int startOffset, char character) {				String text= line.getText();		if (text == null)			return 0;				int resultOffset= startOffset;				int position= text.indexOf(character, startOffset - line.getOffset());		if (position == -1) {						if (character != SEMICHAR || !isForStatement(text, startOffset)) {				int i;				for (i= text.length(); i >= 1; i--) {					if (!Character.isWhitespace(text.charAt(i-1)))						break;				}				resultOffset= line.getOffset() + i;			}					} else {			resultOffset= position + line.getOffset();		}				return resultOffset;	}