@Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    PsiFile file = e.getData(CommonDataKeys.PSI_FILE);
    if (file == null) return;
    VirtualFile virtualFile = file.getVirtualFile();
    if (virtualFile == null) return;

    Project project = file.getProject();
    ConfigurationContext context = ConfigurationContext.getFromContext(e.getDataContext(), e.getPlace());
    ShRunConfigurationProducer configProducer = RunConfigurationProducer.getInstance(ShRunConfigurationProducer.class);
    RunnerAndConfigurationSettings configurationSettings = configProducer.findExistingConfiguration(context);
    ShRunConfiguration runConfiguration;
    if (configurationSettings == null) {
      configurationSettings = RunManager.getInstance(project).createConfiguration(file.getName(), ShConfigurationType.class);
      runConfiguration = (ShRunConfiguration)configurationSettings.getConfiguration();
      runConfiguration.setScriptPath(virtualFile.getPath());
      runConfiguration.setExecuteScriptFile(true);
      runConfiguration.setScriptWorkingDirectory(virtualFile.getParent().getPath());
      if (file instanceof ShFile) {
        @NlsSafe String defaultShell = ShConfigurationType.getDefaultShell(project);
        String shebang = ShShebangParserUtil.getShebangExecutable((ShFile)file);
        if (shebang != null) {
          Pair<String, String> result = parseInterpreterAndOptions(shebang);
          runConfiguration.setInterpreterPath(result.first);
          runConfiguration.setInterpreterOptions(result.second);
        } else {
          runConfiguration.setInterpreterPath(defaultShell);
        }
      }
      else {
        runConfiguration.setInterpreterPath("");
      }
    } else {
      runConfiguration = (ShRunConfiguration)configurationSettings.getConfiguration();
    }

    ExecutionEnvironmentBuilder builder =
      ExecutionEnvironmentBuilder.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), runConfiguration);
    if (builder != null) {
      ExecutionManager.getInstance(project).restartRunProfile(builder.build());
    }
  }
@Override
  public void actionPerformed(@NotNull AnActionEvent e)