本文整理匯總了Java中com.intellij.execution.configurations.GeneralCommandLine.addParameters方法的典型用法代碼示例。如果您正苦於以下問題:Java GeneralCommandLine.addParameters方法的具體用法?Java GeneralCommandLine.addParameters怎麽用?Java GeneralCommandLine.addParameters使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類com.intellij.execution.configurations.GeneralCommandLine
的用法示例。
在下文中一共展示了GeneralCommandLine.addParameters方法的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);
}
示例2: addArgs
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
private static void addArgs(@NotNull GeneralCommandLine command, @Nullable BrowserSpecificSettings settings, @NotNull String[] additional) {
List<String> specific = settings == null ? Collections.<String>emptyList() : settings.getAdditionalParameters();
if (specific.size() + additional.length > 0) {
if (isOpenCommandUsed(command)) {
if (BrowserUtil.isOpenCommandSupportArgs()) {
command.addParameter("--args");
}
else {
LOG.warn("'open' command doesn't allow to pass command line arguments so they will be ignored: " +
StringUtil.join(specific, ", ") + " " + Arrays.toString(additional));
return;
}
}
command.addParameters(specific);
command.addParameters(additional);
}
}
示例3: doCheckExecutable
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
protected static boolean doCheckExecutable(@NotNull String executable, @NotNull List<String> processParameters) {
try {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(executable);
commandLine.addParameters(processParameters);
CapturingProcessHandler handler = new CapturingProcessHandler(commandLine.createProcess(), CharsetToolkit.getDefaultSystemCharset());
ProcessOutput result = handler.runProcess(TIMEOUT_MS);
boolean timeout = result.isTimeout();
int exitCode = result.getExitCode();
String stderr = result.getStderr();
if (timeout) {
LOG.warn("Validation of " + executable + " failed with a timeout");
}
if (exitCode != 0) {
LOG.warn("Validation of " + executable + " failed with a non-zero exit code: " + exitCode);
}
if (!stderr.isEmpty()) {
LOG.warn("Validation of " + executable + " failed with a non-empty error output: " + stderr);
}
return !timeout && exitCode == 0 && stderr.isEmpty();
}
catch (Throwable t) {
LOG.warn(t);
return false;
}
}
示例4: printCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Test
public void printCommandLine() {
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath("e x e path");
commandLine.addParameter("with space");
commandLine.addParameter("\"quoted\"");
commandLine.addParameter("\"quoted with spaces\"");
commandLine.addParameters("param 1", "param2");
commandLine.addParameter("trailing slash\\");
assertEquals("\"e x e path\"" +
" \"with space\"" +
" \\\"quoted\\\"" +
" \"\\\"quoted with spaces\\\"\"" +
" \"param 1\"" +
" param2" +
" \"trailing slash\\\"",
commandLine.getCommandLineString());
}
示例5: passingArgumentsToJavaAppThroughCmdScriptAndWinShell
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Test
public void passingArgumentsToJavaAppThroughCmdScriptAndWinShell() throws Exception {
assumeTrue(SystemInfo.isWindows);
Pair<GeneralCommandLine, File> command = makeHelperCommand(null, CommandTestHelper.ARG);
File script = ExecUtil.createTempExecutableScript("my script ", ".cmd", "@" + command.first.getCommandLineString() + " %*");
try {
GeneralCommandLine commandLine = new GeneralCommandLine(ExecUtil.getWindowsShellName(), "/D", "/C", "call", script.getAbsolutePath());
commandLine.addParameters(ARGUMENTS);
String output = execHelper(pair(commandLine, command.second));
checkParamPassing(output, ARGUMENTS);
}
finally {
FileUtil.delete(script);
}
}
示例6: 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;
}
示例7: 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;
}
示例8: buildTunnelCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@NotNull
private GeneralCommandLine buildTunnelCommandLine(@NotNull String sshPath) {
GeneralCommandLine result = new GeneralCommandLine(sshPath);
boolean isPuttyLinkClient = StringUtil.endsWithIgnoreCase(FileUtil.getNameWithoutExtension(sshPath), "plink");
SvnConfigurationState state = getState();
// quiet mode
if (!isPuttyLinkClient) {
result.addParameter("-q");
}
result.addParameters(isPuttyLinkClient ? "-P" : "-p", String.valueOf(state.sshPort));
if (!StringUtil.isEmpty(state.sshUserName)) {
result.addParameters("-l", state.sshUserName);
}
if (SvnConfiguration.SshConnectionType.PRIVATE_KEY.equals(state.sshConnectionType) && !StringUtil.isEmpty(state.sshPrivateKeyPath)) {
result.addParameters("-i", FileUtil.toSystemIndependentName(state.sshPrivateKeyPath));
}
return result;
}
示例9: 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();
}
}
}
示例10: getState
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor, @NotNull ExecutionEnvironment environment) throws ExecutionException {
final CommandLineState state = new CommandLineState(environment) {
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
GoalRuntime runtime = GoalRuntime.instance;
System.out.println("runtime is created");
final GeneralCommandLine line = new GeneralCommandLine();
line.setRedirectErrorStream(true);
line.setExePath("java");
line.addParameters("-cp","-debug", runtime.getRuntimePath().toString(),
"goal.tools.Run",
GoalDebugConfiguration.this.runFilePath);
System.out.println("command: " + line.getCommandLineString());
final Process process = line.createProcess();
return new OSProcessHandler(process, line.getCommandLineString());
}
};
return state;
}
示例11: getState
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Nullable
@Override
public RunProfileState getState(@NotNull Executor executor,
@NotNull ExecutionEnvironment environment)
throws ExecutionException {
final CommandLineState state = new CommandLineState(environment) {
@NotNull
@Override
protected ProcessHandler startProcess() throws ExecutionException {
final GoalRuntime runtime = GoalRuntime.getInstance();
//TODO: MAke sure that the preferences are used when running goal.
//final Path preferences = GoalRunConfiguration.this.writePreferences();
final GeneralCommandLine line = new GeneralCommandLine();
line.setRedirectErrorStream(true);
line.setExePath("java");
line.addParameters(
"-cp", runtime.getRuntimePath().toString(),
"goal.tools.Run",
//preferences.toString(),
GoalRunConfiguration.this.runFilePath
);
System.out.println("command: " + line.getCommandLineString());
final Process process = line.createProcess();
return new OSProcessHandler(process, line.getCommandLineString());
}
};
return state;
}
示例12: generateCommandLine
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@Override
protected GeneralCommandLine generateCommandLine() {
GeneralCommandLine commandLine = new GeneralCommandLine();
final LuaRunConfiguration cfg = (LuaRunConfiguration) getRunConfiguration();
commandLine.setExePath("java");
commandLine.addParameters("-cp", LUAJ_JAR.getPath(), "lua");
return configureCommandLine(commandLine);
}
示例13: 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);
}
示例14: show
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
public void show(DiffRequest request) {
saveContents(request);
GeneralCommandLine commandLine = new GeneralCommandLine();
commandLine.setExePath(getToolPath());
try {
commandLine.addParameters(getParameters(request));
commandLine.createProcess();
}
catch (Exception e) {
ExecutionErrorDialog.show(new ExecutionException(e.getMessage()),
DiffBundle.message("cant.launch.diff.tool.error.message"), request.getProject());
}
}
示例15: doExecute
import com.intellij.execution.configurations.GeneralCommandLine; //導入方法依賴的package包/類
@NotNull
private static OSProcessHandler doExecute(@NotNull String exePath,
@Nullable String workingDirectory,
@Nullable VirtualFile scriptFile,
String[] parameters,
@Nullable Charset charset) throws ExecutionException {
GeneralCommandLine commandLine = new GeneralCommandLine(exePath);
if (scriptFile != null) {
commandLine.addParameter(scriptFile.getPresentableUrl());
}
commandLine.addParameters(parameters);
if (workingDirectory != null) {
commandLine.setWorkDirectory(workingDirectory);
}
LOG.debug("Command line: ", commandLine.getCommandLineString());
LOG.debug("Command line env: ", commandLine.getEnvironment());
if (charset == null) {
charset = EncodingManager.getInstance().getDefaultCharset();
}
final OSProcessHandler processHandler = new ColoredProcessHandler(commandLine.createProcess(),
commandLine.getCommandLineString(),
charset);
if (LOG.isDebugEnabled()) {
processHandler.addProcessListener(new ProcessAdapter() {
@Override
public void onTextAvailable(ProcessEvent event, Key outputType) {
LOG.debug(outputType + ": " + event.getText());
}
});
}
return processHandler;
}