Search in sources :

Example 6 with ParametersList

use of com.intellij.execution.configurations.ParametersList 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());
}
Also used : ParamsGroup(com.intellij.execution.configurations.ParamsGroup) ParametersList(com.intellij.execution.configurations.ParametersList)

Example 7 with ParametersList

use of com.intellij.execution.configurations.ParametersList 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());
}
Also used : ParamsGroup(com.intellij.execution.configurations.ParamsGroup) ParametersList(com.intellij.execution.configurations.ParametersList) Test(org.junit.Test)

Example 8 with ParametersList

use of com.intellij.execution.configurations.ParametersList 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());
}
Also used : ParamsGroup(com.intellij.execution.configurations.ParamsGroup) ParametersList(com.intellij.execution.configurations.ParametersList) Test(org.junit.Test)

Example 9 with ParametersList

use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.

the class ParametersListTest method paramsGroupClone.

@Test
public void paramsGroupClone() {
    ParametersList params = new ParametersList();
    ParamsGroup group1 = params.addParamsGroup("id1");
    group1.addParameter("group1_param1");
    ParamsGroup group2 = params.addParamsGroup("id2");
    group2.addParameter("group2_param1");
    ParamsGroup group3 = params.addParamsGroup("id3");
    group3.addParameter("group3_param1");
    ParametersList params_clone = params.clone();
    params.removeParamsGroup(0);
    group2.addParameter("group2_param2");
    assertEquals("group2_param1 group2_param2 group3_param1", params.getParametersString().trim());
    assertEquals("group1_param1 group2_param1 group3_param1", params_clone.getParametersString().trim());
}
Also used : ParamsGroup(com.intellij.execution.configurations.ParamsGroup) ParametersList(com.intellij.execution.configurations.ParametersList) Test(org.junit.Test)

Example 10 with ParametersList

use of com.intellij.execution.configurations.ParametersList in project intellij-community by JetBrains.

the class ParametersListTest method checkTokenizer.

private static void checkTokenizer(String paramString, String... expected) {
    ParametersList params = new ParametersList();
    params.addParametersString(paramString);
    assertEquals(asList(expected), params.getList());
    List<String> lines = ParametersListUtil.parse(paramString, true);
    assertEquals(paramString, StringUtil.join(lines, " "));
}
Also used : ParametersList(com.intellij.execution.configurations.ParametersList)

Aggregations

ParametersList (com.intellij.execution.configurations.ParametersList)30 ParamsGroup (com.intellij.execution.configurations.ParamsGroup)9 Test (org.junit.Test)9 VirtualFile (com.intellij.openapi.vfs.VirtualFile)4 File (java.io.File)4 SelectedBundle (org.osmorc.run.ui.SelectedBundle)4 CantRunException (com.intellij.execution.CantRunException)3 Sdk (com.intellij.openapi.projectRoots.Sdk)3 MultiMap (com.intellij.util.containers.MultiMap)3 ExecutionException (com.intellij.execution.ExecutionException)2 JavaParameters (com.intellij.execution.configurations.JavaParameters)2 SimpleJavaParameters (com.intellij.execution.configurations.SimpleJavaParameters)2 JavaSdkType (com.intellij.openapi.projectRoots.JavaSdkType)2 GeneralCommandLine (com.intellij.execution.configurations.GeneralCommandLine)1 JavaProjectData (com.intellij.externalSystem.JavaProjectData)1 IdeaPluginDescriptor (com.intellij.ide.plugins.IdeaPluginDescriptor)1 PluginId (com.intellij.openapi.extensions.PluginId)1 DataNode (com.intellij.openapi.externalSystem.model.DataNode)1 Module (com.intellij.openapi.module.Module)1 SdkTypeId (com.intellij.openapi.projectRoots.SdkTypeId)1