void setTextToEditor(String text) {
      EditorImpl editor = (EditorImpl)myEditor;
      editor.getMarkupModel().removeAllHighlighters();
      editor.getDocument().setText(text);
      editor.resetSizes();
      editor.getHighlighter().setText(text);
      if (myTextAttributes != null) {
        editor.getMarkupModel().addRangeHighlighter(0, editor.getDocument().getTextLength(),
                                                      HighlighterLayer.ADDITIONAL_SYNTAX, myTextAttributes, HighlighterTargetArea.EXACT_RANGE);
      }

      editor.setPaintSelection(mySelected);
      SelectionModel selectionModel = editor.getSelectionModel();
      selectionModel.setSelection(0, mySelected ? editor.getDocument().getTextLength() : 0);
      editor.getCaretModel().updateVisualPosition();
    }
void setTextToEditor(String text)