public static void touchDocument(final Editor editor) {
final Document document = editor.getDocument();
// restart highlighting
final PsiFile file = DocumentUtil.getFile(editor);
if (file instanceof DBLanguageFile) {
DBLanguageFile dbLanguageFile = (DBLanguageFile) file;
DBLanguage dbLanguage = dbLanguageFile.getDBLanguage();
if (dbLanguage != null) {
ConnectionHandler connectionHandler = dbLanguageFile.getActiveConnection();
DBLanguageSyntaxHighlighter syntaxHighlighter = getSyntaxHighlighter(dbLanguage, connectionHandler);
EditorHighlighter editorHighlighter = HighlighterFactory.createHighlighter(syntaxHighlighter, editor.getColorsScheme());
((EditorEx) editor).setHighlighter(editorHighlighter);
}
}
new CommandWriteActionRunner(editor.getProject()) {
public void run() {
// touch the editor to trigger parsing
String text = document.getText();
BlockSupport.getInstance(file.getProject()).reparseRange(file, 0, text.length(), text);
refreshEditorAnnotations(file);
}
}.start();
//refreshEditorAnnotations(editor.getProject());