use of com.intellij.execution.console.LanguageConsoleView in project intellij-community by JetBrains.
the class GroovyShellRunnerImpl method createConsoleView.
@Override
protected LanguageConsoleView createConsoleView() {
final LanguageConsoleView res = new GroovyShellLanguageConsoleView(getProject(), getConsoleTitle());
final GroovyFileImpl file = (GroovyFileImpl) res.getFile();
assert file.getContext() == null;
file.putUserData(GROOVY_SHELL_FILE, Boolean.TRUE);
file.setContext(myShellRunner.getContext(myModule));
return res;
}
use of com.intellij.execution.console.LanguageConsoleView in project intellij-community by JetBrains.
the class PyExecuteSelectionAction method startConsole.
private static void startConsole(final Project project, final Consumer<PyCodeExecutor> consumer, Module context) {
final PythonConsoleToolWindow toolWindow = PythonConsoleToolWindow.getInstance(project);
if (toolWindow != null && toolWindow.getConsoleContentDescriptors().size() > 0) {
toolWindow.activate(() -> {
List<RunContentDescriptor> descs = toolWindow.getConsoleContentDescriptors();
RunContentDescriptor descriptor = descs.get(0);
if (descriptor != null && descriptor.getExecutionConsole() instanceof PyCodeExecutor) {
consumer.consume((PyCodeExecutor) descriptor.getExecutionConsole());
}
});
} else {
PythonConsoleRunnerFactory consoleRunnerFactory = PythonConsoleRunnerFactory.getInstance();
PydevConsoleRunner runner = consoleRunnerFactory.createConsoleRunner(project, null);
runner.addConsoleListener(new PydevConsoleRunner.ConsoleListener() {
@Override
public void handleConsoleInitialized(LanguageConsoleView consoleView) {
if (consoleView instanceof PyCodeExecutor) {
consumer.consume((PyCodeExecutor) consoleView);
if (toolWindow != null) {
toolWindow.getToolWindow().show(null);
}
}
}
});
runner.run();
}
}
use of com.intellij.execution.console.LanguageConsoleView in project intellij-community by JetBrains.
the class XEvaluateInConsoleFromEditorActionHandler method getConsoleExecuteAction.
@Nullable
public static ConsoleExecuteAction getConsoleExecuteAction(@Nullable ConsoleView consoleView) {
if (!(consoleView instanceof LanguageConsoleView)) {
return null;
}
List<AnAction> actions = ActionUtil.getActions(((LanguageConsoleView) consoleView).getConsoleEditor().getComponent());
ConsoleExecuteAction action = ContainerUtil.findInstance(actions, ConsoleExecuteAction.class);
return action == null || !action.isEnabled() ? null : action;
}
use of com.intellij.execution.console.LanguageConsoleView in project intellij-community by JetBrains.
the class PyConsoleTask method runTestOn.
@Override
public void runTestOn(final String sdkHome) throws Exception {
final Project project = getProject();
final Sdk sdk = createTempSdk(sdkHome, SdkCreationType.EMPTY_SDK);
setProcessCanTerminate(false);
PydevConsoleRunner consoleRunner = new PydevConsoleRunnerImpl(project, sdk, PyConsoleType.PYTHON, myFixture.getTempDirPath(), Maps.newHashMap(), PyConsoleOptions.getInstance(project).getPythonConsoleSettings(), (s) -> {
});
before();
myConsoleInitSemaphore = new Semaphore(0);
consoleRunner.addConsoleListener(new PydevConsoleRunnerImpl.ConsoleListener() {
@Override
public void handleConsoleInitialized(LanguageConsoleView consoleView) {
myConsoleInitSemaphore.release();
}
});
consoleRunner.run();
waitFor(myConsoleInitSemaphore);
myCommandSemaphore = new Semaphore(1);
myConsoleView = consoleRunner.getConsoleView();
myProcessHandler = consoleRunner.getProcessHandler();
myExecuteHandler = consoleRunner.getConsoleExecuteActionHandler();
myCommunication = consoleRunner.getPydevConsoleCommunication();
myCommunication.addCommunicationListener(new ConsoleCommunicationListener() {
@Override
public void commandExecuted(boolean more) {
myCommandSemaphore.release();
}
@Override
public void inputRequested() {
}
});
myProcessHandler.addProcessListener(new ProcessAdapter() {
@Override
public void processTerminated(ProcessEvent event) {
if (event.getExitCode() != 0 && !myProcessCanTerminate) {
Assert.fail("Process terminated unexpectedly\n" + output());
}
}
});
OutputPrinter myOutputPrinter = null;
if (shouldPrintOutput) {
myOutputPrinter = new OutputPrinter();
myOutputPrinter.start();
}
waitForOutput("PyDev console");
try {
testing();
after();
} finally {
setProcessCanTerminate(true);
if (myOutputPrinter != null) {
myOutputPrinter.stop();
}
disposeConsole();
}
}
Aggregations