Package org.python.pydev.debug.newconsole.env

Examples of org.python.pydev.debug.newconsole.env.UserCanceledException


            // a while to get started.

            String result = null;
            for (int commAttempts = 0; commAttempts < maximumAttempts; commAttempts++) {
                if (monitor.isCanceled())
                    throw new UserCanceledException("Canceled before hello was successful");
                try {
                    Object[] resulta;
                    resulta = (Object[]) client.execute("hello", new Object[] { "Hello pydevconsole" });
                    result = resulta[0].toString();
                } catch (XmlRpcException e) {
View Full Code Here


                    } catch (Exception e) {
                        // Don't hide important information from user
                        Log.log(e);
                    }
                    if (ex instanceof UserCanceledException) {
                        UserCanceledException userCancelled = (UserCanceledException) ex;
                        throw userCancelled;
                    }
                    String message = "Unexpected error setting up the debugger connection. ";
                    if (ex instanceof SocketTimeoutException) {
                        message = "Timed out after " + InteractiveConsolePrefs.getMaximumAttempts()
                                + " attempts to connect to the console.";
                    }
                    throw new CoreException(PydevDebugPlugin.makeStatus(IStatus.ERROR, message, ex));
                }

                int acceptTimeout = PydevPrefs.getPreferences().getInt(PydevEditorPrefs.CONNECT_TIMEOUT);
                PyDebugTargetConsole pyDebugTargetConsole = null;
                IProcess eclipseProcess = interpreter.getLaunch().getProcesses()[0];
                RemoteDebuggerConsole debugger = new RemoteDebuggerConsole();
                ListenConnector connector = new ListenConnector(acceptTimeout);
                debugger.startConnect(connector);
                pyDebugTargetConsole = new PyDebugTargetConsole(consoleCommunication, interpreter.getLaunch(),
                        eclipseProcess, debugger);

                Socket socket = null;
                try {
                    consoleCommunication.connectToDebugger(connector.getLocalPort());
                    socket = debugger.waitForConnect(monitor, process, eclipseProcess);
                    if (socket == null) {
                        throw new UserCanceledException("Cancelled");
                    }
                } catch (Exception ex) {
                    try {
                        if (ex instanceof UserCanceledException) {
                            //Only close the console communication if the user actually cancelled (otherwise the user will expect it to still be working).
                            consoleCommunication.close();
                            debugger.dispose(); //Can't terminate the process either!
                        } else {
                            //But we still want to dispose of the connector.
                            debugger.disposeConnector();
                        }
                    } catch (Exception e) {
                        // Don't hide important information from user
                        Log.log(e);
                    }
                    if (ex instanceof UserCanceledException) {
                        UserCanceledException userCancelled = (UserCanceledException) ex;
                        throw userCancelled;
                    }
                    String message = "Unexpected error setting up the debugger";
                    if (ex instanceof SocketTimeoutException) {
                        message = "Timed out after " + Float.toString(acceptTimeout / 1000)
View Full Code Here

TOP

Related Classes of org.python.pydev.debug.newconsole.env.UserCanceledException

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.