Search in sources :

Example 1 with AbstractDebugTarget

use of org.python.pydev.debug.model.AbstractDebugTarget in project Pydev by fabioz.

the class CurrentExceptionView method makeLastVisibleInTree.

/**
 * Makes the exception visible for each entry.
 */
@Override
protected void makeLastVisibleInTree(Object input) {
    if (input instanceof List) {
        List<AbstractDebugTarget> targets = (List) input;
        if (targets.size() > 0) {
            // i.e.: scroll to the last added element.
            AbstractDebugTarget element = targets.get(targets.size() - 1);
            List<CaughtException> currExceptions = element.getCurrExceptions();
            if (currExceptions.size() > 0) {
                CaughtException caughtException = currExceptions.get(currExceptions.size() - 1);
                if (caughtException != null) {
                    viewer.reveal(caughtException);
                }
            }
        }
    }
}
Also used : CaughtException(org.python.pydev.debug.model.CaughtException) AbstractDebugTarget(org.python.pydev.debug.model.AbstractDebugTarget) ArrayList(java.util.ArrayList) List(java.util.List)

Example 2 with AbstractDebugTarget

use of org.python.pydev.debug.model.AbstractDebugTarget in project Pydev by fabioz.

the class GetReferrersCommandHandler method execute.

@Override
public Object execute(ExecutionEvent event) throws ExecutionException {
    ISelection selection = HandlerUtil.getCurrentSelection(event);
    Tuple<AbstractDebugTarget, IVariableLocator> context = RunCustomOperationCommand.extractContextFromSelection(selection);
    if (context != null) {
        ReferrersView view = ReferrersView.getView(true);
        if (view != null) {
            view.showReferrersFor(context.o1, context.o2);
        } else {
            Log.log("Could not find ReferrersView.");
        }
    }
    return null;
}
Also used : AbstractDebugTarget(org.python.pydev.debug.model.AbstractDebugTarget) ISelection(org.eclipse.jface.viewers.ISelection) ReferrersView(org.python.pydev.debug.referrers.ReferrersView) IVariableLocator(org.python.pydev.debug.model.IVariableLocator)

Example 3 with AbstractDebugTarget

use of org.python.pydev.debug.model.AbstractDebugTarget in project Pydev by fabioz.

the class RemoteDebuggerServer method dispose.

@Override
public void dispose() {
    synchronized (lock) {
        if (this.inDispose) {
            return;
        }
        this.inDispose = true;
        try {
            this.stopListening();
            if (launch != null) {
                for (AbstractDebugTarget target : targets) {
                    launch.removeDebugTarget(target);
                    target.terminate();
                }
            }
            targets.clear();
        } finally {
            this.inDispose = false;
        }
    }
}
Also used : AbstractDebugTarget(org.python.pydev.debug.model.AbstractDebugTarget)

Example 4 with AbstractDebugTarget

use of org.python.pydev.debug.model.AbstractDebugTarget in project Pydev by fabioz.

the class ProcessServerOutputStream method checkFinishedLine.

/**
 * Checks if the last thing entered was a new line, and if it was, notifies clients about it.
 */
private void checkFinishedLine() {
    String s = this.toString();
    this.reset();
    char c;
    if (s.length() > 0 && ((c = s.charAt(s.length() - 1)) == '\n' || c == '\r')) {
        IAdaptable context = DebugUITools.getDebugContext();
        if (context != null) {
            s = StringUtils.rightTrim(s);
            Object adapter = context.getAdapter(IDebugTarget.class);
            if (adapter instanceof AbstractDebugTarget) {
                AbstractDebugTarget target = (AbstractDebugTarget) adapter;
                for (IConsoleInputListener listener : participants) {
                    listener.newLineReceived(s, target);
                }
            }
        }
    }
}
Also used : IAdaptable(org.eclipse.core.runtime.IAdaptable) IConsoleInputListener(org.python.pydev.debug.core.IConsoleInputListener) AbstractDebugTarget(org.python.pydev.debug.model.AbstractDebugTarget)

Example 5 with AbstractDebugTarget

use of org.python.pydev.debug.model.AbstractDebugTarget in project Pydev by fabioz.

the class ReferrersView method createListener.

@Override
protected ILaunchAndDebugListener createListener() {
    return new ILaunchAndDebugListener() {

        @Override
        public void launchRemoved(ILaunch launch) {
            IDebugTarget debugTarget = launch.getDebugTarget();
            if (debugTarget instanceof AbstractDebugTarget) {
                remove((AbstractDebugTarget) debugTarget);
            }
        }

        @Override
        public void launchChanged(ILaunch launch) {
            if (launch.isTerminated()) {
                this.launchRemoved(launch);
            }
        }

        @Override
        public void launchAdded(ILaunch launch) {
        }

        @Override
        public void handleDebugEvents(DebugEvent[] events) {
            for (DebugEvent debugEvent : events) {
                if (debugEvent.getSource() instanceof AbstractDebugTarget) {
                    if (debugEvent.getKind() == DebugEvent.TERMINATE) {
                        AbstractDebugTarget debugTarget = (AbstractDebugTarget) debugEvent.getSource();
                        remove(debugTarget);
                    }
                }
            }
        }

        private void remove(AbstractDebugTarget debugTarget) {
            if (debugTarget.isTerminated()) {
                synchronized (xmlToReferrersLock) {
                    Iterator<XMLToReferrersInfo> iterator = xmlToReferrers.iterator();
                    while (iterator.hasNext()) {
                        XMLToReferrersInfo next = iterator.next();
                        if (next.target == debugTarget) {
                            iterator.remove();
                        }
                    }
                }
                updateTreeJob.schedule();
            }
        }
    };
}
Also used : XMLToReferrersInfo(org.python.pydev.debug.model.XMLUtils.XMLToReferrersInfo) DebugEvent(org.eclipse.debug.core.DebugEvent) AbstractDebugTarget(org.python.pydev.debug.model.AbstractDebugTarget) ILaunchAndDebugListener(org.python.pydev.debug.views.ILaunchAndDebugListener) ILaunch(org.eclipse.debug.core.ILaunch) IDebugTarget(org.eclipse.debug.core.model.IDebugTarget)

Aggregations

AbstractDebugTarget (org.python.pydev.debug.model.AbstractDebugTarget)13 IDebugTarget (org.eclipse.debug.core.model.IDebugTarget)4 IVariableLocator (org.python.pydev.debug.model.IVariableLocator)3 ArrayList (java.util.ArrayList)2 IAdaptable (org.eclipse.core.runtime.IAdaptable)2 ISelection (org.eclipse.jface.viewers.ISelection)2 CaughtException (org.python.pydev.debug.model.CaughtException)2 PyVariable (org.python.pydev.debug.model.PyVariable)2 AbstractDebuggerCommand (org.python.pydev.debug.model.remote.AbstractDebuggerCommand)2 EvaluateConsoleExpressionCommand (org.python.pydev.debug.model.remote.EvaluateConsoleExpressionCommand)2 IOException (java.io.IOException)1 InputStream (java.io.InputStream)1 Socket (java.net.Socket)1 Dictionary (java.util.Dictionary)1 Hashtable (java.util.Hashtable)1 List (java.util.List)1 IStatus (org.eclipse.core.runtime.IStatus)1 DebugEvent (org.eclipse.debug.core.DebugEvent)1 DebugException (org.eclipse.debug.core.DebugException)1 ILaunch (org.eclipse.debug.core.ILaunch)1