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