@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Project project = e.getProject();
    if (project == null) return;
    EditorImpl editor = ObjectUtils.tryCast(e.getData(CommonDataKeys.EDITOR), EditorImpl.class);
    if (editor == null) return;
    List<Caret> carets = editor.getCaretModel().getAllCarets();
    if (carets.isEmpty()) return;

    Pair<String, Boolean> res =
      Messages.showInputDialogWithCheckBox("Inlay text:", carets.size() > 1 ? "Add Inlays" : "Add Inlay",
                                           "Relates to preceding text", false, true,
                                           Messages.getInformationIcon(), null, new NonEmptyInputValidator());
    String inlayText = res.getFirst();
    boolean relatesToPrecedingText = res.getSecond();
    if (inlayText == null) return;

    int[] offsets = StreamEx.of(carets).mapToInt(Caret::getOffset).toArray();
    InlayModel model = editor.getInlayModel();
    for (int offset : offsets) {
      AtomicReference<Inlay<?>> ref = new AtomicReference<>();
      MenuOnClickPresentation presentation = new MenuOnClickPresentation(new PresentationFactory(editor).text(inlayText), project, () -> {
        return Collections.singletonList(new AnAction(InternalActionsBundle.messagePointer("action.AddInlayInternalAction.Anonymous.text.remove"),
                                                      InternalActionsBundle.messagePointer("action.AddInlayInternalAction.Anonymous.description.remove.this.inlay"),
                                                      AllIcons.Actions.Cancel) {
          @Override
          public void actionPerformed(@NotNull AnActionEvent e1) {
            Inlay<?> inlay = ref.get();
            if (inlay != null) {
              Disposer.dispose(inlay);
            }
          }
        });
      });
      Inlay<?> inlay = model.addInlineElement(offset, relatesToPrecedingText, new PresentationRenderer(presentation));
      ref.set(inlay);
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)