@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    Editor editor = e.getData(CommonDataKeys.EDITOR);
    if (editor instanceof EditorImpl) {
      PyExecuteConsoleCustomizer.Companion.getInstance().notifySciCellGutterExecuted((EditorImpl)editor, "ExecuteInPyConsoleAction");
    }
    Project project = e.getData(CommonDataKeys.PROJECT);
    if (editor != null && project != null) {
      PythonRunConfiguration config = PyExecuteConsoleCustomizer.Companion.getInstance().getContextConfig(e.getDataContext());
      final String selectionText = getSelectionText(editor);
      if (!PyExecuteInConsole.checkIfAvailableAndShowHint(editor)) return;
      if (selectionText != null) {
        PyExecuteInConsole.executeCodeInConsole(project, selectionText, editor, true, true, false, config);
      }
      else {
        TextRange range = EditorUtil.calcCaretLineTextRange(editor);
        if (!range.isEmpty()) {
          String line = editor.getDocument().getText(range);
          PyExecuteInConsole.executeCodeInConsole(project, line.trim(), editor, true, true, false, config);
          editor.getCaretModel().moveToOffset(range.getEndOffset());
          editor.getScrollingModel().scrollToCaret(ScrollType.RELATIVE);
        }
      }
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)