Cleanup (OSProcessHandler(cl.startProcess(), cl.getCommandLine(), cl.getCharset()) -> OSProcessHandler(cl))

This commit is contained in:
Roman Shevchenko
2015-09-25 19:04:26 +03:00
parent 84b4bc94a5
commit 2dc2f33df5
11 changed files with 43 additions and 75 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -15,31 +15,26 @@
*/
package com.intellij.execution.configurations;
import com.intellij.execution.ExecutionException;
import com.intellij.execution.process.ColoredProcessHandler;
import com.intellij.execution.process.DefaultJavaProcessHandler;
import com.intellij.execution.process.OSProcessHandler;
import com.intellij.execution.process.ProcessTerminatedListener;
import com.intellij.execution.ExecutionException;
import org.jetbrains.annotations.NotNull;
/**
* @author spleaner
*/
public class JavaCommandLineStateUtil {
private JavaCommandLineStateUtil() {
}
private JavaCommandLineStateUtil() { }
@NotNull
public static OSProcessHandler startProcess(@NotNull final GeneralCommandLine commandLine) throws ExecutionException {
public static OSProcessHandler startProcess(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
return startProcess(commandLine, false);
}
@NotNull
public static OSProcessHandler startProcess(@NotNull final GeneralCommandLine commandLine,
final boolean ansiColoring) throws ExecutionException {
final OSProcessHandler processHandler = ansiColoring ? new ColoredProcessHandler(commandLine)
: new DefaultJavaProcessHandler(commandLine);
public static OSProcessHandler startProcess(@NotNull GeneralCommandLine commandLine, boolean ansiColoring) throws ExecutionException {
OSProcessHandler processHandler = ansiColoring ? new ColoredProcessHandler(commandLine) : new OSProcessHandler(commandLine);
ProcessTerminatedListener.attach(processHandler);
return processHandler;
}
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2009 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -20,27 +20,22 @@ import com.intellij.execution.configurations.CommandLineBuilder;
import com.intellij.execution.configurations.GeneralCommandLine;
import com.intellij.execution.configurations.JavaParameters;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.nio.charset.Charset;
/** @deprecated use {@link OSProcessHandler} (to be removed in IDEA 17) */
@SuppressWarnings("unused")
public class DefaultJavaProcessHandler extends OSProcessHandler {
private final Charset myCharset;
public DefaultJavaProcessHandler(final JavaParameters javaParameters) throws ExecutionException {
this(CommandLineBuilder.createFromJavaParameters(javaParameters));
public DefaultJavaProcessHandler(@NotNull JavaParameters javaParameters) throws ExecutionException {
super(CommandLineBuilder.createFromJavaParameters(javaParameters));
}
public DefaultJavaProcessHandler(final GeneralCommandLine commandLine) throws ExecutionException {
this(commandLine.createProcess(), commandLine.getCommandLineString(), commandLine.getCharset());
public DefaultJavaProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
super(commandLine);
}
public DefaultJavaProcessHandler(final Process process, final String commandLine, @NotNull final Charset charset) {
super(process, commandLine);
myCharset = charset;
}
@Override
public Charset getCharset() {
return myCharset;
public DefaultJavaProcessHandler(@NotNull Process process, @Nullable String commandLine, @NotNull Charset charset) {
super(process, commandLine, charset);
}
}