// Only call from inside the UI-thread. private void moveCaretTo(int index) { TextConsoleViewer consoleViewer = page.getViewer(); StyledText styledText = consoleViewer.getTextWidget(); styledText.setCaretOffset(index); consoleViewer.revealRange(index, 0); }
@Override public void setDocument(final IDocument document) { final IDocument oldDocument = getDocument(); if (oldDocument != null) { oldDocument.removeDocumentListener(getDocumentListener()); } super.setDocument(document); if (document != null) { document.addDocumentListener(getDocumentListener()); } }