Search in sources :

Example 1 with ResolveBreakpointHandler

use of com.google.cloud.tools.intellij.debugger.CloudDebugProcessStateController.ResolveBreakpointHandler in project google-cloud-intellij by GoogleCloudPlatform.

the class CloudDebugProcess method navigateToSnapshot.

/**
 * Finds the snapshot associated with the given id and sets it as the active snapshot in the
 * current debug session.
 */
public void navigateToSnapshot(@NotNull final String id) {
    if (Strings.isNullOrEmpty(id)) {
        LOG.error("unexpected navigation to empty breakpoint id");
        return;
    }
    navigatedSnapshotId = id;
    getStateController().resolveBreakpointAsync(id, new ResolveBreakpointHandler() {

        @Override
        public void onSuccess(@NotNull final Breakpoint result) {
            ApplicationManager.getApplication().invokeLater(() -> {
                // selections getting queued up.
                if (id.equals(navigatedSnapshotId)) {
                    if (!Boolean.TRUE.equals(result.getIsFinalState()) || result.getStackFrames() == null) {
                        getBreakpointHandler().navigateTo(result);
                        if (result.getStackFrames() == null) {
                            navigateToBreakpoint(result);
                        }
                        return;
                    }
                    navigateToBreakpoint(result);
                }
            }, ModalityState.NON_MODAL);
        }

        @Override
        public void onError(String errorMessage) {
            LOG.warn("Could not navigate to breakpoint:" + errorMessage);
        }
    });
}
Also used : XBreakpoint(com.intellij.xdebugger.breakpoints.XBreakpoint) CloudLineBreakpoint(com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType.CloudLineBreakpoint) XLineBreakpoint(com.intellij.xdebugger.breakpoints.XLineBreakpoint) Breakpoint(com.google.api.services.clouddebugger.v2.model.Breakpoint) ResolveBreakpointHandler(com.google.cloud.tools.intellij.debugger.CloudDebugProcessStateController.ResolveBreakpointHandler)

Aggregations

Breakpoint (com.google.api.services.clouddebugger.v2.model.Breakpoint)1 ResolveBreakpointHandler (com.google.cloud.tools.intellij.debugger.CloudDebugProcessStateController.ResolveBreakpointHandler)1 CloudLineBreakpoint (com.google.cloud.tools.intellij.debugger.CloudLineBreakpointType.CloudLineBreakpoint)1 XBreakpoint (com.intellij.xdebugger.breakpoints.XBreakpoint)1 XLineBreakpoint (com.intellij.xdebugger.breakpoints.XLineBreakpoint)1