當前位置: 首頁>>代碼示例>>Java>>正文


Java GeneralCommandLine.setWorkDirectory方法代碼示例

本文整理匯總了Java中com.intellij.execution.configurations.GeneralCommandLine.setWorkDirectory方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralCommandLine.setWorkDirectory方法的具體用法?Java GeneralCommandLine.setWorkDirectory怎麽用?Java GeneralCommandLine.setWorkDirectory使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在com.intellij.execution.configurations.GeneralCommandLine的用法示例。


在下文中一共展示了GeneralCommandLine.setWorkDirectory方法的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: getProcessOutput

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@NotNull
public static ProcessOutput getProcessOutput(final int timeout, @NotNull final String workDir,
                                             @NotNull final String exePath,
                                             @NotNull final String... arguments) throws ExecutionException {
    if (!new File(workDir).isDirectory()
            || (!new File(exePath).canExecute()
                && !exePath.equals("java"))) {
        return new ProcessOutput();
    }

    final GeneralCommandLine cmd = new GeneralCommandLine();
    cmd.setWorkDirectory(workDir);
    cmd.setExePath(exePath);
    cmd.addParameters(arguments);

    return execute(cmd, timeout);
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:18,代碼來源:LuaSystemUtil.java

示例2: configureCommandLine

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
protected GeneralCommandLine configureCommandLine(GeneralCommandLine commandLine) {
    final LuaRunConfiguration configuration = (LuaRunConfiguration) runConfiguration;
    commandLine.getParametersList().addParametersString(configuration.getInterpreterOptions());

    if (!StringUtil.isEmptyOrSpaces(configuration.getWorkingDirectory())) {
        commandLine.setWorkDirectory(configuration.getWorkingDirectory());
    }

    if (!StringUtil.isEmptyOrSpaces(configuration.getScriptName())) {
        commandLine.addParameter(configuration.getScriptName());
    }

    commandLine.getParametersList().addParametersString(configuration.getScriptParameters());

    return commandLine;
}
 
開發者ID:internetisalie,項目名稱:lua-for-idea,代碼行數:17,代碼來源:LuaCommandLineState.java

示例3: lint

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@NotNull
public static ProcessOutput lint(@NotNull String cwd, @NotNull String file, @NotNull String stylintExe, @Nullable String config) throws ExecutionException {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(cwd);
    commandLine.setExePath(stylintExe);

    commandLine.addParameter(file);
    commandLine.addParameter("--reporter");
    commandLine.addParameter("stylint-json-reporter");
    if (StringUtils.isNotEmpty(config)) {
        commandLine.addParameter("--config");
        commandLine.addParameter(config);
    }

    return NodeRunner.execute(commandLine, TIME_OUT);
}
 
開發者ID:sertae,項目名稱:stylint-plugin,代碼行數:17,代碼來源:StylintRunner.java

示例4: setWorkingDirectory

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
protected void setWorkingDirectory(@NotNull final GeneralCommandLine cmd) {
  final String workingDirectory = myConfiguration.getWorkingDirectory();
  if (!StringUtil.isEmptyOrSpaces(workingDirectory)) {
    cmd.withWorkDirectory(workingDirectory);
  }
  else if (myConfiguration instanceof AbstractPythonTestRunConfiguration) {
    final String folderName = ((AbstractPythonTestRunConfiguration)myConfiguration).getFolderName();
    if (!StringUtil.isEmptyOrSpaces(folderName)) {
      cmd.withWorkDirectory(folderName);
    }
    else {
      final String scriptName = ((AbstractPythonTestRunConfiguration)myConfiguration).getScriptName();
      if (StringUtil.isEmptyOrSpaces(scriptName)) return;
      final VirtualFile script = LocalFileSystem.getInstance().findFileByPath(scriptName);
      if (script == null) return;
      cmd.withWorkDirectory(script.getParent().getPath());
    }
  }
  if (cmd.getWorkDirectory() == null) { // If current dir still not set, lets use project dir
    cmd.setWorkDirectory(myConfiguration.getWorkingDirectorySafe());
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:23,代碼來源:PythonTestCommandLineStateBase.java

示例5: 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

示例6: GitHandler

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
/**
 * A constructor
 *
 * @param project   a project
 * @param directory a process directory
 * @param command   a command to execute (if empty string, the parameter is ignored)
 */
protected GitHandler(@NotNull Project project, @NotNull File directory, @NotNull GitCommand command) {
  myProject = project;
  myCommand = command;
  myAppSettings = GitVcsApplicationSettings.getInstance();
  myProjectSettings = GitVcsSettings.getInstance(myProject);
  myEnv = new HashMap<String, String>(EnvironmentUtil.getEnvironmentMap());
  myVcs = ObjectUtils.assertNotNull(GitVcs.getInstance(project));
  myWorkingDirectory = directory;
  myCommandLine = new GeneralCommandLine();
  if (myAppSettings != null) {
    myCommandLine.setExePath(myAppSettings.getPathToGit());
  }
  myCommandLine.setWorkDirectory(myWorkingDirectory);
  if (GitVersionSpecialty.CAN_OVERRIDE_GIT_CONFIG_FOR_COMMAND.existsIn(myVcs.getVersion())) {
    myCommandLine.addParameters("-c", "core.quotepath=false");
  }
  myCommandLine.addParameter(command.name());
  myStdoutSuppressed = true;
  mySilent = myCommand.lockingPolicy() == GitCommand.LockingPolicy.READ;
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:28,代碼來源:GitHandler.java

示例7: ShellCommand

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public ShellCommand(@Nullable List<String> commandLine, @Nullable String dir, @Nullable Charset charset) {
  if (commandLine == null || commandLine.isEmpty()) {
    throw new IllegalArgumentException("commandLine is empty");
  }
  myCommandLine = new GeneralCommandLine(commandLine);
  if (dir != null) {
    myCommandLine.setWorkDirectory(new File(dir));
  }
  if (charset != null) {
    myCommandLine.setCharset(charset);
  }
  if (ApplicationManager.getApplication().isUnitTestMode()) {
    //ignore all hg config files except current repository config
    myCommandLine.getEnvironment().put("HGRCPATH", "");
  }
}
 
開發者ID:jskierbi,項目名稱:intellij-ce-playground,代碼行數:17,代碼來源:ShellCommand.java

示例8: executeShell

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
/**
 * 執行shell
 *
 * @param shell
 */
public void executeShell(String shell, String workDirectory) {
    GeneralCommandLine commandLine =RNPathUtil.createFullPathCommandLine(shell, workDirectory);
    commandLine.setWorkDirectory(workDirectory);
    myGeneralCommandLine = commandLine;
    try {
        processCommandline(commandLine);
    } catch (ExecutionException e) {
        NotificationUtils.showNotification("Unable to run the commandline:" + e.getMessage(),
                NotificationType.WARNING);
    }
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:17,代碼來源:RNConsoleImpl.java

示例9: executeRawShell

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
/**
 * Execute raw commands without any path or param modify.
 *
 * @param shell
 */
public void executeRawShell(String workDirectory, String[] shell) {
    GeneralCommandLine commandLine =new GeneralCommandLine(shell);
    commandLine.setWorkDirectory(workDirectory);
    myGeneralCommandLine = commandLine;
    try {
        processCommandline(commandLine);
    } catch (ExecutionException e) {
        NotificationUtils.showNotification("Unable to run the commandline:" + e.getMessage(),
                NotificationType.WARNING);
    }
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:17,代碼來源:RNConsoleImpl.java

示例10: runGradleCI

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public static void runGradleCI(Project project, String... params) {
        String path = RNPathUtil.getRNProjectPath(project);
        String gradleLocation = RNPathUtil.getAndroidProjectPath(path);
        if (gradleLocation == null) {
            NotificationUtils.gradleFileNotFound();
        } else {
            GeneralCommandLine commandLine = new GeneralCommandLine();
//    ExecutionEnvironment environment = getEnvironment();
            commandLine.setWorkDirectory(gradleLocation);
            commandLine.setExePath("." + File.separator + "gradlew");
            commandLine.addParameters(params);

//            try {
////            Process process = commandLine.createProcess();
//                OSProcessHandler processHandler = new KillableColoredProcessHandler(commandLine);
//                RunnerUtil.showHelperProcessRunContent("Update AAR", processHandler, project, DefaultRunExecutor.getRunExecutorInstance());
//                // Run
//                processHandler.startNotify();
//            } catch (ExecutionException e) {
//                e.printStackTrace();
//                NotificationUtils.errorNotification("Can't execute command: " + e.getMessage());
//            }

            // commands process
            try {
                processCommandline(project, commandLine);
            } catch (ExecutionException e) {
                e.printStackTrace();
            }
        }
    }
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:32,代碼來源:RNUtil.java

示例11: build

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public static void build(Project project) {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setWorkDirectory(project.getBasePath());
    commandLine.setExePath("python");
    commandLine.addParameter("freeline.py");
    // debug
    commandLine.addParameter("-d");

    // commands process
    try {
        processCommandline(project, commandLine);
    } catch (ExecutionException e) {
        e.printStackTrace();
    }
}
 
開發者ID:beansoftapp,項目名稱:react-native-console,代碼行數:16,代碼來源:RNUtil.java

示例12: doOKAction

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Override
protected void doOKAction() {

    Notification notification = new Notification("LaravelStorm",
            "Success", "temp content", NotificationType.INFORMATION);

    Notification errorNotification = new Notification("LaravelStorm",
            "Error", "Could not create file.", NotificationType.ERROR);

    GeneralCommandLine cmd = new GeneralCommandLine("php", "artisan");
    cmd.setWorkDirectory(project.getBasePath());

    cmd.addParameter(artisanCommand);

    if (additionCommandCheckBox.isSelected())
        cmd.addParameter(optionCmdParameter);

    cmd.addParameter(fileName.getText());

    try {
        BufferedReader reader = new BufferedReader(new InputStreamReader(cmd.createProcess().getInputStream()));
        String execResult = reader.readLine();
        if (execResult.isEmpty()){
            Notifications.Bus.notify(errorNotification, project);
        }
        else{
            notification.setContent(execResult);
            Notifications.Bus.notify(notification, project);
        }
    } catch (ExecutionException | IOException e) {
        e.printStackTrace();
    }

    super.doOKAction();
}
 
開發者ID:3mmarg97,項目名稱:LaravelStorm,代碼行數:36,代碼來源:FileMakerDlg.java

示例13: getProtractorRunCommand

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
private GeneralCommandLine getProtractorRunCommand(@NotNull Config config) {
    GeneralCommandLine commandLine = new GeneralCommandLine();
    commandLine.setExePath(config.getProtractorCmdPath());
    commandLine.setWorkDirectory(project.getBasePath());
    commandLine.addParameter(config.getProtractorConfigJsPath());

    StringBuilder specArg = new StringBuilder().append("--specs=").append(config.getFeaturesDirPath()).append("/").append(fileName);
    if(icon == SCENARIO_ICON) {
        specArg.append(":").append(line + 1);
    }

    commandLine.addParameter(specArg.toString());

    return commandLine;
}
 
開發者ID:KariiO,項目名稱:Gherkin-TS-Runner,代碼行數:16,代碼來源:GherkinIconRenderer.java

示例14: enableExecution

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
private static void enableExecution(@NotNull final File filePath) {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  
  commandLine.setExePath("chmod");
  commandLine.addParameter("+x");
  commandLine.addParameter(filePath.getName());
  commandLine.setWorkDirectory(filePath.getParent());

  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  if (execResult.getExitCode() != 0) {
    LOG.warn("Failed to set executable attribute for " + filePath + ": chmod +x exit code is " + execResult.getExitCode());
  }
}
 
開發者ID:JetBrains,項目名稱:teamcity-powershell,代碼行數:14,代碼來源:PowerShellServiceUnix.java

示例15: enableExecution

import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
/**
 * Set executable attribute for file.
 * @param filePath File to be setted executable attribute
 * @param baseDir Directory to be setted Work Directory
 */
private static void enableExecution(@NotNull final String filePath, @NotNull final String baseDir) {
  final GeneralCommandLine commandLine = new GeneralCommandLine();
  commandLine.setExePath("chmod");
  commandLine.addParameter("+x");
  commandLine.addParameter(filePath);
  commandLine.setWorkDirectory(baseDir);
  final ExecResult execResult = SimpleCommandLineProcessRunner.runCommand(commandLine, null);
  if(execResult.getExitCode() != 0) {
    Loggers.AGENT.warn("Failed to set executable attribute for " + filePath + ": chmod +x exit code is " + execResult.getExitCode());
  }
}
 
開發者ID:unix-junkie,項目名稱:teamcity-autotools-plugin,代碼行數:17,代碼來源:AutotoolsBuildCLBService.java


注:本文中的com.intellij.execution.configurations.GeneralCommandLine.setWorkDirectory方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。