mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
Cleanup (formatting)
This commit is contained in:
+4
-6
@@ -26,15 +26,13 @@ import org.jetbrains.annotations.NotNull;
|
||||
* @author traff
|
||||
*/
|
||||
public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHandler {
|
||||
public CapturingAnsiEscapesAwareProcessHandler(@NotNull GeneralCommandLine commandLine)
|
||||
throws ExecutionException {
|
||||
public CapturingAnsiEscapesAwareProcessHandler(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
|
||||
super(commandLine);
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #CapturingAnsiEscapesAwareProcessHandler(Process, String)} instead (to be removed in IDEA 17) */
|
||||
@SuppressWarnings({"deprecation", "unused"})
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated use {@link CapturingAnsiEscapesAwareProcessHandler#CapturingAnsiEscapesAwareProcessHandler(Process, String)} instead
|
||||
*/
|
||||
public CapturingAnsiEscapesAwareProcessHandler(Process process) {
|
||||
super(process);
|
||||
}
|
||||
@@ -72,4 +70,4 @@ public class CapturingAnsiEscapesAwareProcessHandler extends CapturingProcessHan
|
||||
addToOutput(text, attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-8
@@ -39,25 +39,20 @@ public class CapturingProcessHandler extends OSProcessHandler {
|
||||
addProcessListener(createProcessAdapter(myOutput));
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #CapturingProcessHandler(Process, Charset, String)} instead (to be removed in IDEA 17) */
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use {@link CapturingProcessHandler#CapturingProcessHandler(Process, Charset, String)} instead
|
||||
*/
|
||||
public CapturingProcessHandler(@NotNull Process process) {
|
||||
this(process, null, "");
|
||||
}
|
||||
|
||||
/** @deprecated Use {@link #CapturingProcessHandler(Process, Charset, String)} instead (to be removed in IDEA 17) */
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated Use {@link CapturingProcessHandler#CapturingProcessHandler(Process, Charset, String)} instead
|
||||
*/
|
||||
public CapturingProcessHandler(@NotNull Process process, @Nullable Charset charset) {
|
||||
this(process, charset, "");
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public CapturingProcessHandler(@NotNull Process process, @Nullable Charset charset, /*@NotNull*/ String commandLine) {
|
||||
super(process, commandLine, charset);
|
||||
|
||||
@@ -13,7 +13,6 @@
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package com.intellij.execution.process;
|
||||
|
||||
import com.intellij.execution.ExecutionException;
|
||||
@@ -39,18 +38,16 @@ public class ColoredProcessHandler extends OSProcessHandler implements AnsiEscap
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public ColoredProcessHandler(@NotNull Process process, /*@NotNull */String commandLine) {
|
||||
public ColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) {
|
||||
super(process, commandLine);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public ColoredProcessHandler(@NotNull Process process, /*@NotNull */String commandLine, @NotNull Charset charset) {
|
||||
public ColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @NotNull Charset charset) {
|
||||
super(process, commandLine, charset);
|
||||
}
|
||||
|
||||
@@ -94,4 +91,4 @@ public class ColoredProcessHandler extends OSProcessHandler implements AnsiEscap
|
||||
protected void textAvailable(final String text, final Key attributes) {
|
||||
super.notifyTextAvailable(text, attributes);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -38,25 +38,21 @@ public class OSProcessHandler extends BaseOSProcessHandler {
|
||||
setHasPty(commandLine instanceof PtyCommandLine);
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #OSProcessHandler(Process, String)} or any other ctor (to be removed in IDEA 17) */
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated use {@link OSProcessHandler#OSProcessHandler(Process, String)} or any other ctr instead
|
||||
*/
|
||||
public OSProcessHandler(@NotNull Process process) {
|
||||
this(process, null);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public OSProcessHandler(@NotNull Process process, /*NotNull*/ String commandLine) {
|
||||
public OSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) {
|
||||
this(process, commandLine, EncodingManager.getInstance().getDefaultCharset());
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public OSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @Nullable Charset charset) {
|
||||
super(process, commandLine, charset);
|
||||
@@ -159,4 +155,4 @@ public class OSProcessHandler extends BaseOSProcessHandler {
|
||||
return super.useNonBlockingRead();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
+3
-5
@@ -54,16 +54,14 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine) {
|
||||
super(process, commandLine);
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not empty
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public KillableColoredProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @NotNull Charset charset) {
|
||||
super(process, commandLine, charset);
|
||||
@@ -170,4 +168,4 @@ public class KillableColoredProcessHandler extends ColoredProcessHandler impleme
|
||||
public static KillableColoredProcessHandler create(@NotNull GeneralCommandLine commandLine) throws ExecutionException {
|
||||
return new KillableColoredProcessHandler(commandLine, true);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -98,11 +98,12 @@ public class CommandLineUtil {
|
||||
@NotNull
|
||||
public static String extractPresentableName(@NotNull String commandLine) {
|
||||
String executable = commandLine.trim();
|
||||
|
||||
if (StringUtil.startsWithChar(executable, '\"') || StringUtil.startsWithChar(executable, '\'')) {
|
||||
char quote = executable.charAt(0);
|
||||
for (int i=1;i<executable.length();i++) {
|
||||
for (int i = 1; i < executable.length(); i++) {
|
||||
if (executable.charAt(i) == quote &&
|
||||
(executable.charAt(i-1) != '\'' || StringUtil.isEscapedBackslash(executable, 0, i-1))) {
|
||||
(executable.charAt(i - 1) != '\'' || StringUtil.isEscapedBackslash(executable, 0, i - 1))) {
|
||||
executable = executable.substring(1, i);
|
||||
break;
|
||||
}
|
||||
@@ -115,4 +116,4 @@ public class CommandLineUtil {
|
||||
|
||||
return new File(executable.trim()).getName();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -48,14 +48,13 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
protected final Process myProcess;
|
||||
protected final String myCommandLine;
|
||||
protected final Charset myCharset;
|
||||
@NotNull protected final String myPresentableName;
|
||||
protected final String myPresentableName;
|
||||
protected final ProcessWaitFor myWaitFor;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param commandLine must be not null (for correct thread attribution in the stacktrace)
|
||||
* {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
|
||||
*/
|
||||
public BaseOSProcessHandler(@NotNull Process process, /*NotNull*/String commandLine, @Nullable Charset charset) {
|
||||
public BaseOSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @Nullable Charset charset) {
|
||||
myProcess = process;
|
||||
myCommandLine = commandLine;
|
||||
myCharset = charset;
|
||||
@@ -159,12 +158,12 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
|
||||
@NotNull
|
||||
protected BaseDataReader createErrorDataReader(@NotNull BaseDataReader.SleepingPolicy sleepingPolicy) {
|
||||
return new SimpleOutputReader(createProcessErrReader(), ProcessOutputTypes.STDERR, sleepingPolicy, "error stream of "+myPresentableName);
|
||||
return new SimpleOutputReader(createProcessErrReader(), ProcessOutputTypes.STDERR, sleepingPolicy, "error stream of " + myPresentableName);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected BaseDataReader createOutputDataReader(@NotNull BaseDataReader.SleepingPolicy sleepingPolicy) {
|
||||
return new SimpleOutputReader(createProcessOutReader(), ProcessOutputTypes.STDOUT, sleepingPolicy, "output stream of "+myPresentableName);
|
||||
return new SimpleOutputReader(createProcessOutReader(), ProcessOutputTypes.STDOUT, sleepingPolicy, "output stream of " + myPresentableName);
|
||||
}
|
||||
|
||||
protected void onOSProcessTerminated(final int exitCode) {
|
||||
@@ -245,7 +244,7 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
return myProcess.getOutputStream();
|
||||
}
|
||||
|
||||
/*NotNull*/
|
||||
/*@NotNull*/
|
||||
public String getCommandLine() {
|
||||
return myCommandLine;
|
||||
}
|
||||
@@ -260,12 +259,8 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
new ThreadPoolExecutor(0, Integer.MAX_VALUE, 1, TimeUnit.SECONDS, new SynchronousQueue<Runnable>(),
|
||||
ConcurrencyUtil.newNamedThreadFactory("OSProcessHandler pooled thread"));
|
||||
|
||||
@NotNull
|
||||
/** @deprecated use {@link BaseOSProcessHandler#submit(Runnable)} instead (to be removed in IDEA 16) */
|
||||
@Deprecated
|
||||
/**
|
||||
* todo remove in IDEA16
|
||||
* @deprecated use {@link BaseOSProcessHandler#submit(Runnable)} instead.
|
||||
*/
|
||||
public static Future<?> submit(@NotNull Runnable task) {
|
||||
return BaseOSProcessHandler.submit(task);
|
||||
}
|
||||
@@ -307,4 +302,4 @@ public class BaseOSProcessHandler extends ProcessHandler implements TaskExecutor
|
||||
public String toString() {
|
||||
return myCommandLine;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -31,16 +31,10 @@ public class ProcessWaitFor {
|
||||
private final Future<?> myWaitForThreadFuture;
|
||||
private final BlockingQueue<Consumer<Integer>> myTerminationCallback = new ArrayBlockingQueue<Consumer<Integer>>(1);
|
||||
|
||||
public void detach() {
|
||||
myWaitForThreadFuture.cancel(true);
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #ProcessWaitFor(Process, TaskExecutor, String)} instead (to be removed in IDEA 17) */
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated use {@link ProcessWaitFor#ProcessWaitFor(Process, TaskExecutor, String)} instead
|
||||
*/
|
||||
public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor) {
|
||||
this(process, executor,"");
|
||||
this(process, executor, "");
|
||||
}
|
||||
|
||||
public ProcessWaitFor(@NotNull final Process process, @NotNull TaskExecutor executor, @NotNull final String presentableName) {
|
||||
@@ -49,7 +43,7 @@ public class ProcessWaitFor {
|
||||
public void run() {
|
||||
String oldThreadName = Thread.currentThread().getName();
|
||||
if (!StringUtil.isEmptyOrSpaces(presentableName)) {
|
||||
Thread.currentThread().setName(StringUtil.first("ProcessWaitFor: "+presentableName, 120, true));
|
||||
Thread.currentThread().setName(StringUtil.first("ProcessWaitFor: " + presentableName, 120, true));
|
||||
}
|
||||
int exitCode = 0;
|
||||
try {
|
||||
@@ -78,7 +72,11 @@ public class ProcessWaitFor {
|
||||
});
|
||||
}
|
||||
|
||||
public void detach() {
|
||||
myWaitForThreadFuture.cancel(true);
|
||||
}
|
||||
|
||||
public void setTerminationCallback(Consumer<Integer> r) {
|
||||
myTerminationCallback.offer(r);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -39,10 +39,8 @@ public abstract class BaseDataReader {
|
||||
mySleepingPolicy = sleepingPolicy != null ? sleepingPolicy: SleepingPolicy.SIMPLE;
|
||||
}
|
||||
|
||||
/** @deprecated use {@link #start(String)} instead (to be removed in IDEA 17) */
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated use {@link BaseDataReader#start(String)} instead
|
||||
*/
|
||||
protected void start() {
|
||||
start("");
|
||||
}
|
||||
@@ -57,7 +55,7 @@ public abstract class BaseDataReader {
|
||||
public void run() {
|
||||
String oldThreadName = Thread.currentThread().getName();
|
||||
if (!StringUtil.isEmptyOrSpaces(presentableName)) {
|
||||
Thread.currentThread().setName(StringUtil.first("BaseDataReader: "+presentableName, 120, true));
|
||||
Thread.currentThread().setName(StringUtil.first("BaseDataReader: " + presentableName, 120, true));
|
||||
}
|
||||
try {
|
||||
doRun();
|
||||
@@ -168,4 +166,4 @@ public abstract class BaseDataReader {
|
||||
LOG.error(e);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user