@Override
protected void doAction(final ISelection sel, final ITextEditor textEditor) {
final IDocument document = textEditor.getDocumentProvider().getDocument(
textEditor.getEditorInput());
final ITextSelection selection = extendSelectionToWholeLines(document,
(ITextSelection) sel);
final ITextSelection getSelection = getTextSelection(document, selection,
textEditor);
String text;
OtpErlangObject r1 = null;
try {
text = document.get(getSelection.getOffset(), getSelection.getLength());
// call erlang, with selection within text
r1 = callErlang(selection.getOffset() - getSelection.getOffset(),
selection.getLength(), text);
} catch (final Exception e) {
ErlLogger.error(e);
}
final String newText = Util.stringValue(r1);