better naming as SHELL environment is CONSOLE
[idea/community.git] / platform / lang-impl / src / com / intellij / execution / configuration / EnvironmentVariablesData.java
index 9550f29db3857232056f08f79f91c0bc59048470..b52e1046487c539eeb755a6b5503ff1abc164708 100644 (file)
@@ -16,6 +16,7 @@
 package com.intellij.execution.configuration;
 
 import com.google.common.collect.ImmutableMap;
 package com.intellij.execution.configuration;
 
 import com.google.common.collect.ImmutableMap;
+import com.intellij.execution.configurations.GeneralCommandLine;
 import com.intellij.util.containers.ContainerUtil;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
 import com.intellij.util.containers.ContainerUtil;
 import org.jdom.Element;
 import org.jetbrains.annotations.NonNls;
@@ -114,6 +115,17 @@ public class EnvironmentVariablesData {
     parent.addContent(envsElement);
   }
 
     parent.addContent(envsElement);
   }
 
+  public void configureCommandLine(@NotNull GeneralCommandLine commandLine, boolean consoleParentEnvs) {
+    if (myPassParentEnvs) {
+      commandLine.withParentEnvironmentType(consoleParentEnvs ? GeneralCommandLine.ParentEnvironmentType.CONSOLE
+                                                              : GeneralCommandLine.ParentEnvironmentType.SYSTEM);
+    }
+    else {
+      commandLine.withParentEnvironmentType(GeneralCommandLine.ParentEnvironmentType.NONE);
+    }
+    commandLine.withEnvironment(myEnvs);
+  }
+
   /**
    * @param envs Map instance containing user-defined environment variables
    *             (iteration order should be reliable user-specified, like {@link LinkedHashMap} or {@link ImmutableMap})
   /**
    * @param envs Map instance containing user-defined environment variables
    *             (iteration order should be reliable user-specified, like {@link LinkedHashMap} or {@link ImmutableMap})