if (selection instanceof ITextSelection) {
ITextSelection ts = (ITextSelection) selection;
showText(ts.getText());
}
if (selection instanceof IMarkSelection) {
IMarkSelection ms = (IMarkSelection) selection;
try {
showText(ms.getDocument().get(ms.getOffset(), ms.getLength()));
} catch (BadLocationException e) {
Log.error(e);
}
}
}