void (@NotNull AnActionEvent e) { final PsiFile file = e.getData(CommonDataKeys.PSI_FILE); if (file == null) return; final Project project = e.getProject(); if (project == null) return; final ConfigurationContext context = ConfigurationContext.getFromContext(e.getDataContext(), e.getPlace()); PythonRunConfigurationProducer configProducer = RunConfigurationProducer.getInstance(PythonRunConfigurationProducer.class); RunnerAndConfigurationSettings settings = configProducer.findExistingConfiguration(context); RunManager runManager = RunManager.getInstance(project); if (settings == null) { final ConfigurationFromContext fromContext = configProducer.createConfigurationFromContext(context); if (fromContext == null) return; settings = fromContext.getConfigurationSettings(); runManager.setTemporaryConfiguration(settings); } final PythonRunConfiguration configuration = (PythonRunConfiguration)settings.getConfiguration(); runManager.setSelectedConfiguration(settings); ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(DefaultRunExecutor.getRunExecutorInstance(), settings); if (builder != null) { boolean oldValueShowCommandline = configuration.showCommandLineAfterwards(); configuration.setShowCommandLineAfterwards(true); synchronized (this) { waitingForExecution.put(configuration, oldValueShowCommandline); } ExecutionManager.getInstance(project).restartRunProfile(builder.build()); } }