public void refreshErrorDisplay() { if (parseErrorHighlightKey != null) editor.getHighlighter().removeHighlight(parseErrorHighlightKey); /* Mapping for gutter */ Map<Integer, String> errorLines = new HashMap<Integer, String>(); if (parseError != null && parseError.hasLineNumbers()) { String error = parseError.getMessage(); // Just the first line. errorLines.put(parseError.getBeginLine(), error); // If error spans multiple lines, this code will put // an error in every line of the gutter. /*for (int line = parseError.getBeginLine(); line <= parseError.getEndLine(); line++) { errorLines.put(line, error); }*/ } gutter.setParseErrors(errorLines); /* Highlighting errors in editor */ if (parseError != null && parseError.hasLineNumbers()) { /* Remove existing highlight */ try { parseErrorHighlightKey = editor .getHighlighter() .addHighlight( computeDocumentOffset(parseError.getBeginLine(), parseError.getBeginColumn()), computeDocumentOffset(parseError.getEndLine(), parseError.getEndColumn()) + 1, errorHighlightPainter); } catch (BadLocationException e) { } } }