use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method moveBreakpoint.
public void moveBreakpoint(int breakpointId) {
// because of Java(Script)'s reference semantics, the editor's instance
// of the breakpoint object is the same one we have here, so we don't
// need to update the line number--we just need to persist the new state.
breakpointStateDirty_ = true;
// the breakpoint knows its position in the function, which needs to be
// recalculated; do that the next time we set breakpoints on this function
Breakpoint breakpoint = getBreakpoint(breakpointId);
if (breakpoint != null) {
breakpoint.markStepsNeedUpdate();
notifyServer(breakpoint, true, false);
}
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method notifyServer.
private void notifyServer(Breakpoint breakpoint, boolean added, boolean arm) {
ArrayList<Breakpoint> bps = new ArrayList<Breakpoint>();
bps.add(breakpoint);
server_.updateBreakpoints(bps, added, arm, new VoidServerRequestCallback());
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method setTopLevelBreakpoint.
// Public methods ---------------------------------------------------------
public Breakpoint setTopLevelBreakpoint(final String path, final int lineNumber) {
final Breakpoint breakpoint = addBreakpoint(Breakpoint.create(currentBreakpointId_++, path, "toplevel", lineNumber, path.equals(activeSource_) ? Breakpoint.STATE_INACTIVE : Breakpoint.STATE_ACTIVE, Breakpoint.TYPE_TOPLEVEL));
// it just yet
if (path.equals(activeSource_))
breakpoint.setPendingDebugCompletion(true);
notifyServer(breakpoint, true, true);
ArrayList<Breakpoint> bps = new ArrayList<Breakpoint>();
bps.add(breakpoint);
return breakpoint;
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method setFunctionBreakpoints.
// Private methods ---------------------------------------------------------
private void setFunctionBreakpoints(FileFunction function) {
ArrayList<String> steps = new ArrayList<String>();
final ArrayList<Breakpoint> breakpoints = new ArrayList<Breakpoint>();
for (Breakpoint breakpoint : breakpoints_) {
if (function.containsBreakpoint(breakpoint)) {
steps.add(breakpoint.getFunctionSteps());
breakpoints.add(breakpoint);
}
}
server_.setFunctionBreakpoints(function.functionName, function.fileName, function.packageName, steps, new ServerRequestCallback<Void>() {
@Override
public void onResponseReceived(Void v) {
for (Breakpoint breakpoint : breakpoints) {
breakpoint.setState(Breakpoint.STATE_ACTIVE);
}
notifyBreakpointsSaved(breakpoints, true);
}
@Override
public void onError(ServerError error) {
discardUnsettableBreakpoints(breakpoints);
}
});
}
use of org.rstudio.studio.client.common.debugging.model.Breakpoint in project rstudio by rstudio.
the class BreakpointManager method clearAllBreakpoints.
private void clearAllBreakpoints() {
Set<FileFunction> functions = new TreeSet<FileFunction>();
for (Breakpoint breakpoint : breakpoints_) {
breakpoint.setState(Breakpoint.STATE_REMOVING);
if (breakpoint.getType() == Breakpoint.TYPE_FUNCTION)
functions.add(new FileFunction(breakpoint));
}
// set previously
for (FileFunction function : functions) {
server_.setFunctionBreakpoints(function.functionName, function.fileName, function.packageName, new ArrayList<String>(), new ServerRequestCallback<Void>() {
@Override
public void onError(ServerError error) {
// There's a possibility here that the breakpoints were
// not successfully cleared, so we may be in a temporarily
// confusing state, but no error message will be less
// confusing.
}
});
}
server_.removeAllBreakpoints(new VoidServerRequestCallback());
notifyBreakpointsSaved(new ArrayList<Breakpoint>(breakpoints_), false);
breakpoints_.clear();
onBreakpointAddOrRemove();
}
Aggregations