int start = Math.min(caret.getDot(), caret.getMark());
int length = Math.abs(caret.getDot() - caret.getMark());
return html.getDocument().getText(start, length);
} catch (BadLocationException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return null;
}