mirror of
https://gitflic.ru/project/openide/openide.git
synced 2026-09-27 10:03:11 +07:00
remove ruby variant of ConsoleExecuteAction — platform implementation is enough
simplification — ConsoleExecuteActionHandler could be also as Condition (we must rename this class to ProcessBackedConsoleExecuteActionHandler — todo)
This commit is contained in:
@@ -48,15 +48,15 @@ public class ConsoleExecuteAction extends DumbAwareAction {
|
||||
* Only internal usage, to keep backward compatibility
|
||||
* to remove in IDEA 14
|
||||
*/
|
||||
public static ConsoleExecuteAction createAction(final LanguageConsoleImpl languageConsole,
|
||||
@Nullable Condition<LanguageConsoleImpl> enabledCondition,
|
||||
final BaseConsoleExecuteActionHandler consoleExecuteActionHandler) {
|
||||
return new ConsoleExecuteAction(languageConsole, new ConsoleExecuteActionHandler(consoleExecuteActionHandler.myPreserveMarkup) {
|
||||
public static ConsoleExecuteAction createAction(@NotNull final LanguageConsoleImpl languageConsole,
|
||||
@NotNull com.intellij.execution.runners.ConsoleExecuteActionHandler consoleExecuteActionHandler) {
|
||||
final ConsoleExecuteActionHandler handler = consoleExecuteActionHandler;
|
||||
return new ConsoleExecuteAction(languageConsole, new ConsoleExecuteActionHandler(handler.myPreserveMarkup) {
|
||||
@Override
|
||||
void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
|
||||
consoleExecuteActionHandler.doExecute(text, languageConsole, null);
|
||||
handler.doExecute(text, languageConsole, null);
|
||||
}
|
||||
}, enabledCondition);
|
||||
}, consoleExecuteActionHandler);
|
||||
}
|
||||
|
||||
ConsoleExecuteAction(@NotNull LanguageConsoleImpl console, final @NotNull ConsoleExecuteActionHandler executeActionHandler, @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
|
||||
|
||||
+17
-5
@@ -19,7 +19,10 @@ import com.intellij.execution.ExecutionException;
|
||||
import com.intellij.execution.ExecutionHelper;
|
||||
import com.intellij.execution.ExecutionManager;
|
||||
import com.intellij.execution.Executor;
|
||||
import com.intellij.execution.console.*;
|
||||
import com.intellij.execution.console.ConsoleExecuteAction;
|
||||
import com.intellij.execution.console.LanguageConsoleImpl;
|
||||
import com.intellij.execution.console.LanguageConsoleView;
|
||||
import com.intellij.execution.console.LanguageConsoleViewImpl;
|
||||
import com.intellij.execution.executors.DefaultRunExecutor;
|
||||
import com.intellij.execution.process.*;
|
||||
import com.intellij.execution.ui.RunContentDescriptor;
|
||||
@@ -219,7 +222,7 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
|
||||
actionList.add(closeAction);
|
||||
|
||||
// run action
|
||||
actionList.add(createConsoleExecAction(myConsoleView, myProcessHandler, myConsoleExecuteActionHandler));
|
||||
actionList.add(createConsoleExecAction(myConsoleView, myConsoleExecuteActionHandler));
|
||||
|
||||
// Help
|
||||
actionList.add(CommonActionsManager.getInstance().createHelpAction("interactive_console"));
|
||||
@@ -241,11 +244,21 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
|
||||
return myConsoleView.getConsole();
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@Deprecated
|
||||
/**
|
||||
* @deprecated to remove in IDEA 14
|
||||
*/
|
||||
public static AnAction createConsoleExecAction(@NotNull LanguageConsoleView console,
|
||||
@NotNull ProcessHandler processHandler,
|
||||
@NotNull ConsoleExecuteActionHandler consoleExecuteActionHandler) {
|
||||
return createConsoleExecAction(console, consoleExecuteActionHandler);
|
||||
}
|
||||
|
||||
public static AnAction createConsoleExecAction(@NotNull LanguageConsoleView console,
|
||||
@NotNull ConsoleExecuteActionHandler consoleExecuteActionHandler) {
|
||||
return new ConsoleExecuteAction(console, consoleExecuteActionHandler, consoleExecuteActionHandler.getEmptyExecuteAction(),
|
||||
new LanguageConsoleBuilder.ProcessBackedExecutionEnabledCondition(processHandler));
|
||||
consoleExecuteActionHandler);
|
||||
}
|
||||
|
||||
@SuppressWarnings("UnusedDeclaration")
|
||||
@@ -256,13 +269,12 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
|
||||
public static AnAction createConsoleExecAction(LanguageConsoleImpl languageConsole,
|
||||
ProcessHandler processHandler,
|
||||
ConsoleExecuteActionHandler consoleExecuteActionHandler) {
|
||||
return ConsoleExecuteAction.createAction(languageConsole, new LanguageConsoleBuilder.ProcessBackedExecutionEnabledCondition(processHandler), consoleExecuteActionHandler);
|
||||
return ConsoleExecuteAction.createAction(languageConsole, consoleExecuteActionHandler);
|
||||
}
|
||||
|
||||
@NotNull
|
||||
protected abstract ConsoleExecuteActionHandler createConsoleExecuteActionHandler();
|
||||
|
||||
|
||||
public T getConsoleView() {
|
||||
return myConsoleView;
|
||||
}
|
||||
|
||||
+8
-1
@@ -16,8 +16,10 @@
|
||||
package com.intellij.execution.runners;
|
||||
|
||||
import com.intellij.execution.console.BaseConsoleExecuteActionHandler;
|
||||
import com.intellij.execution.console.LanguageConsoleImpl;
|
||||
import com.intellij.execution.process.BaseOSProcessHandler;
|
||||
import com.intellij.execution.process.ProcessHandler;
|
||||
import com.intellij.openapi.util.Condition;
|
||||
import org.jetbrains.annotations.NotNull;
|
||||
|
||||
import java.io.IOException;
|
||||
@@ -27,7 +29,7 @@ import java.nio.charset.Charset;
|
||||
/**
|
||||
* @author traff
|
||||
*/
|
||||
public class ConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler {
|
||||
public class ConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler implements Condition<LanguageConsoleImpl> {
|
||||
private volatile ProcessHandler myProcessHandler;
|
||||
|
||||
public ConsoleExecuteActionHandler(ProcessHandler processHandler, boolean preserveMarkup) {
|
||||
@@ -72,4 +74,9 @@ public class ConsoleExecuteActionHandler extends BaseConsoleExecuteActionHandler
|
||||
final ProcessHandler handler = myProcessHandler;
|
||||
return handler == null || handler.isProcessTerminated();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean value(LanguageConsoleImpl console) {
|
||||
return isProcessTerminated();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user