@Override
  public void update(@NotNull AnActionEvent e) {
    Editor editor = e.getData(CommonDataKeys.EDITOR);
    Presentation presentation = e.getPresentation();

    boolean enabled = false;
    if (isPython(editor)) {
      String text = getSelectionText(editor);
      if (text != null) {
        presentation.setText(PyBundle.message("python.execute.selection.action.execute.selection.in.console"));
        enabled = !text.isEmpty();
      }
      else if (!EditorUtil.calcCaretLineTextRange(editor).isEmpty()) {
        presentation.setText(PyBundle.message("python.execute.selection.action.execute.line.in.console"));
        enabled = true;
      }
    }

    presentation.setEnabledAndVisible(enabled);
  }
@Override
  public void update(@NotNull AnActionEvent e)