use of org.rstudio.studio.client.common.debugging.events.BreakpointsSavedEvent in project rstudio by rstudio.
the class BreakpointManager method notifyBreakpointsSaved.
private void notifyBreakpointsSaved(ArrayList<Breakpoint> breakpoints, boolean saved) {
breakpointStateDirty_ = true;
events_.fireEvent(new BreakpointsSavedEvent(breakpoints, saved));
}
use of org.rstudio.studio.client.common.debugging.events.BreakpointsSavedEvent in project rstudio by rstudio.
the class BreakpointManager method onSessionInit.
// Event handlers ----------------------------------------------------------
@Override
public void onSessionInit(SessionInitEvent sie) {
// Establish a persistent object for the breakpoints. Note that this
// object is read by the server on init, so the scope/name pair here
// needs to match the pair on the server.
new JSObjectStateValue("debug-breakpoints", "debugBreakpointsState", ClientState.PROJECT_PERSISTENT, session_.getSessionInfo().getClientState(), false) {
@Override
protected void onInit(JsObject value) {
if (value != null) {
BreakpointState state = value.cast();
// restore all of the breakpoints
JsArray<Breakpoint> breakpoints = state.getPersistedBreakpoints();
for (int idx = 0; idx < breakpoints.length(); idx++) {
Breakpoint breakpoint = breakpoints.get(idx);
// make sure the next breakpoint we create after a restore
// has a value larger than any existing breakpoint
currentBreakpointId_ = Math.max(currentBreakpointId_, breakpoint.getBreakpointId() + 1);
addBreakpoint(breakpoint);
}
// this initialization happens after the source windows are
// up, so fire an event to the editor to show all known
// breakpoints. as new source windows are opened, they will
// call getBreakpointsInFile to populate themselves.
events_.fireEvent(new BreakpointsSavedEvent(breakpoints_, true));
}
}
@Override
protected JsObject getValue() {
BreakpointState state = BreakpointState.create();
for (Breakpoint breakpoint : breakpoints_) {
state.addPersistedBreakpoint(breakpoint);
}
breakpointStateDirty_ = false;
return state.cast();
}
@Override
protected boolean hasChanged() {
return breakpointStateDirty_;
}
};
}
Aggregations