XSuspendContext context = getSession().getSuspendContext(); if (context == null) { context = new BallerinaSuspendContext(BallerinaDebugProcess.this, message);
@Override public void stop() { // If we don't call this using the executeOnPooledThread(), the UI will hang until the debug server is stopped. ApplicationManager.getApplication().executeOnPooledThread(() -> { XDebugSession session = getSession(); if (!isRemoteDebugMode) { XSuspendContext suspendContext = session.getSuspendContext(); if (suspendContext != null) { XExecutionStack activeExecutionStack = suspendContext.getActiveExecutionStack(); if (activeExecutionStack instanceof BallerinaSuspendContext.BallerinaExecutionStack) { String workerID = ((BallerinaSuspendContext.BallerinaExecutionStack) activeExecutionStack) .getMyWorkerID(); if (workerID != null) { myConnector.sendCommand(Command.STOP, workerID); } } } else { session.stop(); return; } } else { myConnector.sendCommand(Command.STOP); session.stop(); getSession().getConsoleView().print("Disconnected from the debug server.\n", ConsoleViewContentType.SYSTEM_OUTPUT); } isDisconnected = true; myConnector.close(); }); }