public static void showByEditor(@NotNull Editor editor, @NotNull JPopupMenu menu) {
    Component invoker = editor.getContentComponent();
    Point caretPoint = editor.visualPositionToXY(editor.getCaretModel().getVisualPosition());
    menu.show(invoker, caretPoint.x, caretPoint.y);
  }
public static void showByEditor(@NotNull Editor editor, @NotNull JPopupMenu menu)