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);
}
}
}
}
}
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;
}
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;
}
}
}
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);
}
}
}
}
}
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();
}
}
};
}
Aggregations