@VisibleForTesting boolean notStoppedAndHasRunProfile(XDebugSession session) { return !session.isStopped() && session.getRunProfile() != null; }
@NotNull private XDebugSession createMockSession(boolean isStopped, RunProfile runProfile) { XDebugSession debugSession = mock(XDebugSession.class); when(debugSession.isStopped()).thenReturn(isStopped); if (runProfile != null) { when(debugSession.getRunProfile()).thenReturn(runProfile); } return debugSession; } }
@Override public void update(AnActionEvent event) { event.getPresentation().setEnabled(!CloudDebugProcess.this.getXDebugSession().isStopped()); } }
@Override public void run() { if (!getXDebugSession().isStopped()) { // Since there is no equivalent metaphor in traditional debug sessions, this simulates // the desired behavior of clearing the current context by setting the current // position // to an empty context getXDebugSession().positionReached(new XSuspendContext() {}); } } });
private void navigateToBreakpoint(@NotNull Breakpoint target) { Date snapshotTime; try { if (target.getFinalTime() == null) { LOG.warn("Could not resolve final time from breakpoint."); snapshotTime = new Date(); } else { snapshotTime = ISODateTimeFormat.dateTime().parseDateTime(target.getFinalTime()).toDate(); } } catch (IllegalArgumentException iae) { LOG.warn("Could not parse breakpoint timestamp using ISO8601."); snapshotTime = new Date(); } DateFormat df = DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT); currentSnapshot = target; if (!getXDebugSession().isStopped()) { getXDebugSession() .positionReached( new MySuspendContext( new CloudExecutionStack( getXDebugSession().getProject(), StackdriverDebuggerBundle.getString( "clouddebug.stackat", df.format(snapshotTime)), target.getStackFrames(), target.getVariableTable(), target.getEvaluatedExpressions()))); } }
&& (breakpoint.getStatus() == null || !Boolean.TRUE.equals(breakpoint.getStatus().getIsError()))) { if (!getXDebugSession().isStopped()) { getBreakpointHandler().setStateToDisabled(breakpoint);