diff --git a/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java b/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java index 97603c4ac6de..dd2f1ccf191b 100644 --- a/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java +++ b/python/openapi/src/com/jetbrains/python/run/PyRunConfigurationFactory.java @@ -28,7 +28,15 @@ public abstract class PyRunConfigurationFactory { return ServiceManager.getService(PyRunConfigurationFactory.class); } - public abstract PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName); + /** + * Creates a run configuration to run a specified Python script. + * + * @param module the module in the context of which the script is run. + * @param scriptName the path to the script file. + * @param singleton if true, the "Check no other instances are running" option will be set for the run configuration. + * @return the settings of the created run configuration. + */ + public abstract PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName, boolean singleton); public abstract RunnerAndConfigurationSettings createRunConfiguration(Module module, ConfigurationFactory factory); } diff --git a/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java index d7f64373fbec..559712533292 100644 --- a/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java +++ b/python/src/com/jetbrains/python/run/PyRunConfigurationFactoryImpl.java @@ -13,8 +13,9 @@ import org.jetbrains.annotations.NotNull; */ public class PyRunConfigurationFactoryImpl extends PyRunConfigurationFactory { @Override - public PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName) { + public PythonRunConfigurationParams createPythonScriptRunConfiguration(Module module, String scriptName, boolean singleton) { RunnerAndConfigurationSettings settings = createRunConfiguration(module, PythonConfigurationType.getInstance().getFactory()); + settings.setSingleton(singleton); PythonRunConfigurationParams configuration = (PythonRunConfigurationParams)settings.getConfiguration(); configuration.setScriptName(scriptName); return configuration;