IDEA-120952

This commit is contained in:
Vladimir Krivosheev
2014-02-19 19:12:14 +01:00
parent 0850b33d82
commit 3f5ed3f67c
2 changed files with 30 additions and 4 deletions
@@ -44,6 +44,21 @@ public class ConsoleExecuteAction extends DumbAwareAction {
this(console, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, Conditions.<LanguageConsoleImpl>alwaysTrue());
}
/**
* 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) {
@Override
void doExecute(@NotNull String text, @NotNull LanguageConsoleImpl console, @Nullable LanguageConsoleView consoleView) {
consoleExecuteActionHandler.doExecute(text, languageConsole, null);
}
}, enabledCondition);
}
ConsoleExecuteAction(@NotNull LanguageConsoleImpl console, final @NotNull ConsoleExecuteActionHandler executeActionHandler, @Nullable Condition<LanguageConsoleImpl> enabledCondition) {
this(console, null, executeActionHandler, CONSOLE_EXECUTE_ACTION_ID, enabledCondition);
}
@@ -97,7 +112,7 @@ public class ConsoleExecuteAction extends DumbAwareAction {
private final ConsoleHistoryModel myConsoleHistoryModel;
private boolean myAddToHistory = true;
private final boolean myPreserveMarkup;
final boolean myPreserveMarkup;
public ConsoleExecuteActionHandler(boolean preserveMarkup) {
myConsoleHistoryModel = new ConsoleHistoryModel();
@@ -241,13 +241,24 @@ public abstract class AbstractConsoleRunnerWithHistory<T extends LanguageConsole
return myConsoleView.getConsole();
}
public static AnAction createConsoleExecAction(final LanguageConsoleView console,
final ProcessHandler processHandler,
final ConsoleExecuteActionHandler consoleExecuteActionHandler) {
public static AnAction createConsoleExecAction(@NotNull LanguageConsoleView console,
@NotNull ProcessHandler processHandler,
@NotNull ConsoleExecuteActionHandler consoleExecuteActionHandler) {
return new ConsoleExecuteAction(console, consoleExecuteActionHandler, consoleExecuteActionHandler.getEmptyExecuteAction(),
new LanguageConsoleBuilder.ProcessBackedExecutionEnabledCondition(processHandler));
}
@SuppressWarnings("UnusedDeclaration")
@Deprecated
/**
* @deprecated to remove in IDEA 14
*/
public static AnAction createConsoleExecAction(LanguageConsoleImpl languageConsole,
ProcessHandler processHandler,
ConsoleExecuteActionHandler consoleExecuteActionHandler) {
return ConsoleExecuteAction.createAction(languageConsole, new LanguageConsoleBuilder.ProcessBackedExecutionEnabledCondition(processHandler), consoleExecuteActionHandler);
}
@NotNull
protected abstract ConsoleExecuteActionHandler createConsoleExecuteActionHandler();