mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (OSProcessHandler(cl.startProcess(), cl.getCommandLine(), cl.getCharset()) -> OSProcessHandler(cl))
This commit is contained in:
+6
-11
@@ -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;
|
||||
}
|
||||
|
||||
+10
-15
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user