Search in sources :

Example 1 with DartVmServiceStackFrame

use of com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame in project intellij-plugins by JetBrains.

the class DartPopFrameAction method getStackFrame.

@Nullable
private static DartVmServiceStackFrame getStackFrame(@NotNull final AnActionEvent e) {
    final Project project = e.getProject();
    if (project == null)
        return null;
    XDebugSession session = e.getData(XDebugSession.DATA_KEY);
    if (session == null) {
        session = XDebuggerManager.getInstance(project).getCurrentSession();
    }
    if (session != null) {
        XStackFrame frame = session.getCurrentStackFrame();
        if (frame instanceof DartVmServiceStackFrame) {
            return ((DartVmServiceStackFrame) frame);
        }
    }
    return null;
}
Also used : Project(com.intellij.openapi.project.Project) XDebugSession(com.intellij.xdebugger.XDebugSession) DartVmServiceStackFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame) XStackFrame(com.intellij.xdebugger.frame.XStackFrame) Nullable(org.jetbrains.annotations.Nullable)

Example 2 with DartVmServiceStackFrame

use of com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame in project intellij-plugins by JetBrains.

the class DartPopFrameAction method update.

public void update(@NotNull AnActionEvent e) {
    DartVmServiceStackFrame frame = getStackFrame(e);
    boolean enabled = frame != null && frame.canDrop();
    if (ActionPlaces.isMainMenuOrActionSearch(e.getPlace()) || ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace())) {
        e.getPresentation().setEnabled(enabled);
    } else {
        e.getPresentation().setVisible(enabled);
    }
}
Also used : DartVmServiceStackFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame)

Example 3 with DartVmServiceStackFrame

use of com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame in project intellij-plugins by JetBrains.

the class VmServiceWrapper method computeStackFrames.

public void computeStackFrames(@NotNull final String isolateId, final int firstFrameIndex, @NotNull final XExecutionStack.XStackFrameContainer container, @Nullable final InstanceRef exception) {
    addRequest(() -> myVmService.getStack(isolateId, new StackConsumer() {

        @Override
        public void received(final Stack vmStack) {
            ApplicationManager.getApplication().executeOnPooledThread(() -> {
                InstanceRef exceptionToAddToFrame = exception;
                // Check to see if the VM passing in awaiter frames; if so, use them. Else check
                // for async causal frames. Finally, fall back to using regular sync frames.
                ElementList<Frame> elementList = vmStack.getAwaiterFrames();
                if (elementList == null) {
                    elementList = vmStack.getAsyncCausalFrames();
                    if (elementList == null) {
                        elementList = vmStack.getFrames();
                    }
                }
                final List<Frame> vmFrames = Lists.newArrayList(elementList);
                final List<XStackFrame> xStackFrames = new ArrayList<>(vmFrames.size());
                for (final Frame vmFrame : vmFrames) {
                    if (vmFrame.getKind() == FrameKind.AsyncSuspensionMarker) {
                        // Render an asynchronous gap.
                        final XStackFrame markerFrame = new DartAsyncMarkerFrame();
                        xStackFrames.add(markerFrame);
                    } else {
                        final DartVmServiceStackFrame stackFrame = new DartVmServiceStackFrame(myDebugProcess, isolateId, vmFrame, vmFrames, exceptionToAddToFrame);
                        stackFrame.setIsDroppableFrame(vmFrame.getKind() == FrameKind.Regular);
                        xStackFrames.add(stackFrame);
                        if (!stackFrame.isInDartSdkPatchFile()) {
                            // The exception (if any) is added to the frame where debugger stops and to the upper frames.
                            exceptionToAddToFrame = null;
                        }
                    }
                }
                container.addStackFrames(firstFrameIndex == 0 ? xStackFrames : xStackFrames.subList(firstFrameIndex, xStackFrames.size()), true);
            });
        }

        @Override
        public void onError(final RPCError error) {
            container.errorOccurred(error.getMessage());
        }
    }));
}
Also used : XStackFrame(com.intellij.xdebugger.frame.XStackFrame) DartAsyncMarkerFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartAsyncMarkerFrame) DartVmServiceStackFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame) DartVmServiceStackFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame) ArrayList(java.util.ArrayList) XStackFrame(com.intellij.xdebugger.frame.XStackFrame) DartAsyncMarkerFrame(com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartAsyncMarkerFrame) XExecutionStack(com.intellij.xdebugger.frame.XExecutionStack)

Aggregations

DartVmServiceStackFrame (com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartVmServiceStackFrame)3 XStackFrame (com.intellij.xdebugger.frame.XStackFrame)2 Project (com.intellij.openapi.project.Project)1 XDebugSession (com.intellij.xdebugger.XDebugSession)1 XExecutionStack (com.intellij.xdebugger.frame.XExecutionStack)1 DartAsyncMarkerFrame (com.jetbrains.lang.dart.ide.runner.server.vmService.frame.DartAsyncMarkerFrame)1 ArrayList (java.util.ArrayList)1 Nullable (org.jetbrains.annotations.Nullable)1