use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class RestCommandLineState method buildCommandLineParameters.
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
ParametersList parametersList = commandLine.getParametersList();
ParamsGroup exeOptions = parametersList.getParamsGroup(GROUP_EXE_OPTIONS);
assert exeOptions != null;
exeOptions.addParametersString(myConfiguration.getInterpreterOptions());
ParamsGroup scriptParameters = parametersList.getParamsGroup(GROUP_SCRIPT);
assert scriptParameters != null;
getRunner().addToGroup(scriptParameters, commandLine);
final String key = getKey();
if (key != null)
scriptParameters.addParameter(key);
scriptParameters.addParameter(getTask());
final String params = myConfiguration.getParams();
if (params != null)
scriptParameters.addParametersString(params);
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getInputFile()))
scriptParameters.addParameter(myConfiguration.getInputFile());
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getOutputFile()))
scriptParameters.addParameter(myConfiguration.getOutputFile());
if (!StringUtil.isEmptyOrSpaces(myConfiguration.getWorkingDirectory()))
commandLine.setWorkDirectory(myConfiguration.getWorkingDirectory());
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class SphinxBaseCommand method createCommandLine.
protected GeneralCommandLine createCommandLine(Module module, List<String> params) throws ExecutionException {
Sdk sdk = PythonSdkType.findPythonSdk(module);
if (sdk == null) {
throw new ExecutionException("No sdk specified");
}
ReSTService service = ReSTService.getInstance(module);
String sdkHomePath = sdk.getHomePath();
GeneralCommandLine cmd = new GeneralCommandLine();
if (sdkHomePath != null) {
final String runnerName = "sphinx-quickstart" + (SystemInfo.isWindows ? ".exe" : "");
String executablePath = PythonSdkType.getExecutablePath(sdkHomePath, runnerName);
if (executablePath != null) {
cmd.setExePath(executablePath);
} else {
cmd = PythonHelper.LOAD_ENTRY_POINT.newCommandLine(sdkHomePath, Lists.<String>newArrayList());
}
}
cmd.setWorkDirectory(service.getWorkdir().isEmpty() ? module.getProject().getBaseDir().getPath() : service.getWorkdir());
PythonCommandLineState.createStandardGroups(cmd);
ParamsGroup scriptParams = cmd.getParametersList().getParamsGroup(PythonCommandLineState.GROUP_SCRIPT);
assert scriptParams != null;
if (params != null) {
for (String p : params) {
scriptParams.addParameter(p);
}
}
final Map<String, String> env = cmd.getEnvironment();
setPythonIOEncoding(env, "utf-8");
setPythonUnbuffered(env);
if (sdkHomePath != null) {
resetHomePathChanges(sdkHomePath, env);
}
env.put("PYCHARM_EP_DIST", "Sphinx");
env.put("PYCHARM_EP_NAME", "sphinx-quickstart");
List<String> pathList = Lists.newArrayList(PythonCommandLineState.getAddedPaths(sdk));
pathList.addAll(PythonCommandLineState.collectPythonPath(module));
PythonCommandLineState.initPythonPath(cmd, true, pathList, sdkHomePath);
PythonSdkType.patchCommandLineForVirtualenv(cmd, sdkHomePath, true);
BuildoutFacet facet = BuildoutFacet.getInstance(module);
if (facet != null) {
facet.patchCommandLineForBuildout(cmd);
}
return cmd;
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class PyCCCommandLineState method buildCommandLineParameters.
@Override
protected void buildCommandLineParameters(GeneralCommandLine commandLine) {
commandLine.setWorkDirectory(myTaskDir.getPath());
ParamsGroup group = commandLine.getParametersList().getParamsGroup(GROUP_SCRIPT);
assert group != null;
Project project = myRunConfiguration.getProject();
Course course = StudyTaskManager.getInstance(project).getCourse();
assert course != null;
group.addParameter(myRunConfiguration.getPathToTest());
group.addParameter(new File(course.getCourseDirectory()).getPath());
String path = getCurrentTaskFilePath();
if (path != null) {
group.addParameter(path);
}
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupAdd.
@Test
public void paramsGroupAdd() {
ParametersList params = new ParametersList();
ParamsGroup group1 = params.addParamsGroup("id1");
assertEquals("id1", group1.getId());
assertEquals(1, params.getParamsGroupsCount());
assertEquals(asList(group1), params.getParamsGroups());
ParamsGroup group2 = params.addParamsGroup("id2");
assertEquals("id2", group2.getId());
assertEquals(2, params.getParamsGroupsCount());
assertEquals(asList(group1, group2), params.getParamsGroups());
}
use of com.intellij.execution.configurations.ParamsGroup in project intellij-community by JetBrains.
the class ParametersListTest method paramsGroupRemove.
@Test
public void paramsGroupRemove() {
ParametersList params = new ParametersList();
params.addParamsGroup("id1");
ParamsGroup group2 = params.addParamsGroup("id2");
ParamsGroup group3 = params.addParamsGroup("id3");
ParamsGroup group4 = params.addParamsGroup("id4");
params.removeParamsGroup(0);
assertEquals(asList(group2, group3, group4), params.getParamsGroups());
params.removeParamsGroup(1);
assertEquals(asList(group2, group4), params.getParamsGroups());
}
Aggregations