当前位置: 首页>>代码示例>>Java>>正文


Java GeneralCommandLine.withEnvironment方法代码示例

本文整理汇总了Java中com.intellij.execution.configurations.GeneralCommandLine.withEnvironment方法的典型用法代码示例。如果您正苦于以下问题:Java GeneralCommandLine.withEnvironment方法的具体用法?Java GeneralCommandLine.withEnvironment怎么用?Java GeneralCommandLine.withEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.intellij.execution.configurations.GeneralCommandLine的用法示例。


在下文中一共展示了GeneralCommandLine.withEnvironment方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: createAndSetupCmdLine

import com.intellij.execution.configurations.GeneralCommandLine; //导入方法依赖的package包/类
/**
 * Creates process builder and setups it's commandLine, working directory, environment variables
 *
 * @param workingDir         Process working dir
 * @param executablePath     Path to executable file
 * @param arguments          Process commandLine  @return process builder
 */
public static GeneralCommandLine createAndSetupCmdLine(@Nullable final String workingDir,
                                                       @Nullable final Map<String, String> userDefinedEnv,
                                                       final boolean passParentEnv,
                                                       @NotNull final String executablePath,
                                                       @NotNull final String... arguments) {
  GeneralCommandLine cmdLine = new GeneralCommandLine();

  cmdLine.setExePath(toSystemDependentName(executablePath));

  if (workingDir != null) {
    cmdLine.setWorkDirectory(toSystemDependentName(workingDir));
  }

  cmdLine.addParameters(arguments);

  cmdLine.withParentEnvironmentType(passParentEnv ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);
  cmdLine.withEnvironment(userDefinedEnv);
  //Inline parent env variables occurrences
  EnvironmentUtil.inlineParentOccurrences(cmdLine.getEnvironment());

  return cmdLine;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:30,代码来源:ProcessRunner.java

示例2: startProcess

import com.intellij.execution.configurations.GeneralCommandLine; //导入方法依赖的package包/类
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
  String scriptPath = runConfiguration.getScriptPath();
  String scriptParameters = runConfiguration.getScriptParameters();
  String scriptOptions = runConfiguration.getScriptOptions();

  scriptPath = scriptPath == null ? "" : scriptPath;//todo change this (and add validator to run config)
  final List<String> commandString = new ArrayList<>();
  commandString.add("/usr/bin/osascript");
  if (!StringUtil.isEmpty(scriptOptions)) {
    String[] options = scriptOptions.split(" ");
    commandString.addAll(Arrays.asList(options));
  }
  commandString.add(scriptPath);
  if (!StringUtil.isEmpty(scriptParameters)) {
    Pattern regex = Pattern.compile("\"([^\"]*)\"|(\\w+)");
    final ArrayList<String> matchedParams = new ArrayList<>();
    Matcher matcher = regex.matcher(scriptParameters);
    while (matcher.find()) {
      for (int i = 1; i <= matcher.groupCount(); i++) {
        try {
          String p = matcher.group(i);
          if (!StringUtil.isEmpty(p)) matchedParams.add(p);
        } catch (IllegalStateException | IndexOutOfBoundsException e) {
          LOG.warn("Error parsing script parameters: " + e.getMessage());
        }
      }
    }
    commandString.addAll(matchedParams);
  }

  final GeneralCommandLine commandLine = new GeneralCommandLine(commandString);
  if (runConfiguration.isShowAppleEvents()) {
    commandLine.withEnvironment("AEDebugSends", "1");
    commandLine.withEnvironment("AEDebugReceives", "1");
  }
  return new AppleScriptProcessHandler(commandLine);
}
 
开发者ID:ant-druha,项目名称:AppleScript-IDEA,代码行数:40,代码来源:AppleScriptScriptCommandLineState.java

示例3: prepareProcessHandler

import com.intellij.execution.configurations.GeneralCommandLine; //导入方法依赖的package包/类
protected OSProcessHandler prepareProcessHandler(@NotNull String exePath, @Nullable String workingDirectory, String[] parameters, @Nullable Map<String, String> environment) throws ExecutionException {
    GeneralCommandLine commandLine = new GeneralCommandLine(exePath);
    commandLine.addParameters(parameters);
    if (workingDirectory != null) {
        commandLine.setWorkDirectory(workingDirectory);
    }

    commandLine.withEnvironment(environment);

    return new ColoredProcessHandler(commandLine);
}
 
开发者ID:atoum,项目名称:phpstorm-plugin,代码行数:12,代码来源:Runner.java

示例4: configureCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //导入方法依赖的package包/类
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);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:EnvironmentVariablesData.java

示例5: setupJVMCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //导入方法依赖的package包/类
public static GeneralCommandLine setupJVMCommandLine(final String exePath,
                                                     final SimpleJavaParameters javaParameters,
                                                     final boolean forceDynamicClasspath) {
  final GeneralCommandLine commandLine = new GeneralCommandLine(exePath);

  final ParametersList vmParametersList = javaParameters.getVMParametersList();
  commandLine.withEnvironment(javaParameters.getEnv());
  commandLine.withParentEnvironmentType(javaParameters.isPassParentEnvs() ? ParentEnvironmentType.CONSOLE : ParentEnvironmentType.NONE);

  final Class commandLineWrapper;
  if ((commandLineWrapper = getCommandLineWrapperClass()) != null) {
    if (forceDynamicClasspath && !vmParametersList.hasParameter("-classpath") && !vmParametersList.hasParameter("-cp")) {
      if (isClassPathJarEnabled(javaParameters, PathUtil.getJarPathForClass(ClassPath.class))) {
        appendJarClasspathParams(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
      else {
        appendOldCommandLineWrapper(javaParameters, commandLine, vmParametersList, commandLineWrapper);
      }
    }
    else {
      appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
    }
  }
  else {
    appendParamsEncodingClasspath(javaParameters, commandLine, vmParametersList);
  }

  final String mainClass = javaParameters.getMainClass();
  final String jarPath = javaParameters.getJarPath();
  if (mainClass != null) {
    commandLine.addParameter(mainClass);
  }
  else if (jarPath != null) {
    commandLine.addParameter("-jar");
    commandLine.addParameter(jarPath);
  }

  commandLine.addParameters(javaParameters.getProgramParametersList().getList());

  commandLine.withWorkDirectory(javaParameters.getWorkingDirectory());

  return commandLine;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:44,代码来源:JdkUtil.java


注:本文中的com.intellij.execution.configurations.GeneralCommandLine.withEnvironment方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。