@Override
 public void removeEditorMouseMotionListener(@NotNull final EditorMouseMotionListener listener) {
   EditorMouseMotionListener wrapper = myEditorMouseMotionListeners.removeWrapper(listener);
   if (wrapper != null) {
     myDelegate.removeEditorMouseMotionListener(wrapper);
   }
 }
 @Override
 public void removeEditorMouseListener(@NotNull final EditorMouseListener listener) {
   EditorMouseListener wrapper = myEditorMouseListeners.removeWrapper(listener);
   // HintManager might have an old editor instance
   if (wrapper != null) {
     myDelegate.removeEditorMouseListener(wrapper);
   }
 }
  @Override
  public void addEditorMouseMotionListener(@NotNull final EditorMouseMotionListener listener) {
    assert isValid();
    EditorMouseMotionListener wrapper =
        new EditorMouseMotionListener() {
          @Override
          public void mouseMoved(EditorMouseEvent e) {
            listener.mouseMoved(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }

          @Override
          public void mouseDragged(EditorMouseEvent e) {
            listener.mouseDragged(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }
        };
    myEditorMouseMotionListeners.registerWrapper(listener, wrapper);
    myDelegate.addEditorMouseMotionListener(wrapper);
  }
  @Override
  public void addEditorMouseListener(@NotNull final EditorMouseListener listener) {
    assert isValid();
    EditorMouseListener wrapper =
        new EditorMouseListener() {
          @Override
          public void mousePressed(EditorMouseEvent e) {
            listener.mousePressed(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }

          @Override
          public void mouseClicked(EditorMouseEvent e) {
            listener.mouseClicked(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }

          @Override
          public void mouseReleased(EditorMouseEvent e) {
            listener.mouseReleased(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }

          @Override
          public void mouseEntered(EditorMouseEvent e) {
            listener.mouseEntered(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }

          @Override
          public void mouseExited(EditorMouseEvent e) {
            listener.mouseExited(
                new EditorMouseEvent(EditorWindow.this, e.getMouseEvent(), e.getArea()));
          }
        };
    myEditorMouseListeners.registerWrapper(listener, wrapper);

    myDelegate.addEditorMouseListener(wrapper);
  }