/**
   * @return created editor. This editor should be released by {@link #disposeEditor(Editor) }
   *     method.
   */
  @NotNull
  private Editor createEditor() {
    Editor editor = EditorFactory.getInstance().createEditor(myDocument, myProject);
    ((EditorMarkupModel) editor.getMarkupModel()).setErrorStripeVisible(true);
    EditorHighlighter highlighter =
        EditorHighlighterFactory.getInstance()
            .createEditorHighlighter(
                myFile, EditorColorsManager.getInstance().getGlobalScheme(), myProject);
    ((EditorEx) editor).setHighlighter(highlighter);
    ((EditorEx) editor).setFile(myFile);

    editor.addEditorMouseListener(myEditorMouseListener);
    ((EditorEx) editor).addPropertyChangeListener(myEditorPropertyChangeListener);

    ((EditorImpl) editor).setDropHandler(new FileDropHandler(editor));

    TextEditorProvider.putTextEditor(editor, myTextEditor);
    return editor;
  }
  public SoftWrapModelImpl(
      @NotNull EditorEx editor,
      @NotNull SoftWrapsStorage storage,
      @NotNull SoftWrapPainter painter,
      @NotNull SoftWrapApplianceManager applianceManager,
      @NotNull CachingSoftWrapDataMapper dataMapper) {
    myEditor = editor;
    myStorage = storage;
    myPainter = painter;
    myApplianceManager = applianceManager;
    myDataMapper = dataMapper;
    myFoldBasedApplianceStrategy = new SoftWrapFoldBasedApplianceStrategy(editor);
    myVisualSizeManager = new SoftWrapAwareVisualSizeManager(painter);

    myDocumentListeners.add(myApplianceManager);
    myFoldListeners.add(myApplianceManager);
    applianceManager.addListener(myVisualSizeManager);
    EditorSettings settings = myEditor.getSettings();
    myAdditionalColumnsCount = settings.getAdditionalColumnsCount();
    myUseSoftWraps = settings.isUseSoftWraps();

    editor.addPropertyChangeListener(this);
  }