use of com.jetbrains.python.console.pydev.ConsoleCommunicationListener in project intellij-community by JetBrains.
the class PythonConsoleView method showVariables.
public void showVariables(PydevConsoleCommunication consoleCommunication) {
PyStackFrame stackFrame = new PyStackFrame(getProject(), consoleCommunication, new PyStackFrameInfo("", "", "", null), null);
final XStandaloneVariablesView view = new XStandaloneVariablesView(getProject(), new PyDebuggerEditorsProvider(), stackFrame);
consoleCommunication.addCommunicationListener(new ConsoleCommunicationListener() {
@Override
public void commandExecuted(boolean more) {
view.rebuildView();
}
@Override
public void inputRequested() {
}
});
mySplitView = view;
Disposer.register(this, view);
splitWindow();
}
use of com.jetbrains.python.console.pydev.ConsoleCommunicationListener in project intellij-community by JetBrains.
the class PydevConsoleRunnerImpl method connectToDebugger.
private XDebugSession connectToDebugger() throws ExecutionException {
final ServerSocket serverSocket = PythonCommandLineState.createServerSocket();
final XDebugSession session = XDebuggerManager.getInstance(myProject).startSessionAndShowTab("Python Console Debugger", PythonIcons.Python.Python, null, true, new XDebugProcessStarter() {
@NotNull
public XDebugProcess start(@NotNull final XDebugSession session) {
PythonDebugLanguageConsoleView debugConsoleView = new PythonDebugLanguageConsoleView(myProject, mySdk);
PyConsoleDebugProcessHandler consoleDebugProcessHandler = new PyConsoleDebugProcessHandler(myProcessHandler);
PyConsoleDebugProcess consoleDebugProcess = new PyConsoleDebugProcess(session, serverSocket, debugConsoleView, consoleDebugProcessHandler);
PythonDebugConsoleCommunication communication = PyDebugRunner.initDebugConsoleView(myProject, consoleDebugProcess, debugConsoleView, consoleDebugProcessHandler, session);
communication.addCommunicationListener(new ConsoleCommunicationListener() {
@Override
public void commandExecuted(boolean more) {
session.rebuildViews();
}
@Override
public void inputRequested() {
}
});
myPydevConsoleCommunication.setDebugCommunication(communication);
debugConsoleView.attachToProcess(consoleDebugProcessHandler);
consoleDebugProcess.waitForNextConnection();
try {
consoleDebugProcess.connect(myPydevConsoleCommunication);
} catch (Exception e) {
//TODO
LOG.error(e);
}
myProcessHandler.notifyTextAvailable("\nDebugger connected.\n", ProcessOutputTypes.STDERR);
return consoleDebugProcess;
}
});
return session;
}
use of com.jetbrains.python.console.pydev.ConsoleCommunicationListener in project intellij-community by JetBrains.
the class PyDebugRunner method initDebugConsoleView.
public static PythonDebugConsoleCommunication initDebugConsoleView(Project project, PyDebugProcess debugProcess, PythonDebugLanguageConsoleView console, ProcessHandler processHandler, final XDebugSession session) {
PythonConsoleView pythonConsoleView = console.getPydevConsoleView();
PythonDebugConsoleCommunication debugConsoleCommunication = new PythonDebugConsoleCommunication(project, debugProcess);
pythonConsoleView.setConsoleCommunication(debugConsoleCommunication);
PydevDebugConsoleExecuteActionHandler consoleExecuteActionHandler = new PydevDebugConsoleExecuteActionHandler(pythonConsoleView, processHandler, debugConsoleCommunication);
pythonConsoleView.setExecutionHandler(consoleExecuteActionHandler);
debugProcess.getSession().addSessionListener(consoleExecuteActionHandler);
new LanguageConsoleBuilder(pythonConsoleView).processHandler(processHandler).initActions(consoleExecuteActionHandler, "py");
debugConsoleCommunication.addCommunicationListener(new ConsoleCommunicationListener() {
@Override
public void commandExecuted(boolean more) {
session.rebuildViews();
}
@Override
public void inputRequested() {
}
});
return debugConsoleCommunication;
}
use of com.jetbrains.python.console.pydev.ConsoleCommunicationListener 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