Пример #1
0
 private void maybeAnchorExecutionLine() {
   PathUtil callFramePath = debuggerState.getActiveCallFramePath();
   if (callFramePath != null && callFramePath.equals(path)) {
     int lineNumber = debuggerState.getActiveCallFrameExecutionLineNumber();
     if (lineNumber >= 0) {
       debuggingModelRenderer.renderExecutionLine(lineNumber);
     }
   }
 }
Пример #2
0
  private void handleOnCallFrameSelect(int callFrameDepth) {
    debuggerState.setActiveCallFrameIndex(callFrameDepth);
    debuggingModelRenderer.renderDebuggerCallFrame();

    PathUtil callFramePath = debuggerState.getActiveCallFramePath();
    if (callFramePath == null) {
      // Not paused, remove the execution line (if any).
      debuggingModelRenderer.removeExecutionLine();
      return;
    }

    maybeAnchorExecutionLine();

    int lineNumber = debuggerState.getActiveCallFrameExecutionLineNumber();
    maybeNavigateToDocument(callFramePath, lineNumber);
  }
Пример #3
0
  private DebuggingModelController(
      Place currentPlace,
      AppContext appContext,
      DebuggingModel debuggingModel,
      Editor editor,
      EditorPopupController editorPopupController,
      DocumentManager documentManager) {
    this.appContext = appContext;
    this.editor = editor;
    this.currentPlace = currentPlace;
    this.debuggingModel = debuggingModel;
    this.leftGutterClickListenerRemover =
        editor.getLeftGutter().getClickListenerRegistrar().add(leftGutterClickListener);

    // Every time we enter workspace, we get a new debugging session id.
    String sessionId =
        BootstrapSession.getBootstrapSession().getActiveClientId()
            + ":"
            + System.currentTimeMillis();
    this.debuggerState = DebuggerState.create(sessionId);

    this.debuggingSidebar = DebuggingSidebar.create(appContext.getResources(), debuggerState);
    this.debuggingModelRenderer =
        DebuggingModelRenderer.create(appContext, editor, debuggingSidebar, debuggerState);
    this.cssLiveEditController = new CssLiveEditController(debuggerState, documentManager);
    this.evaluationPopupController =
        EvaluationPopupController.create(
            appContext.getResources(), editor, editorPopupController, debuggerState);

    this.debuggingModel.addModelChangeListener(debuggingModelChangeListener);
    this.debuggerState.getDebuggerStateListenerRegistrar().add(debuggerStateListener);
    this.debuggingSidebar.getDebuggerCommandListenerRegistrar().add(userCommandListener);
  }
Пример #4
0
  private boolean runApplication(SourceMapping sourceMapping, String absoluteResourceUri) {
    if (debuggerState.isDebuggerAvailable()) {
      debuggerState.runDebugger(sourceMapping, absoluteResourceUri);

      JsonArray<Breakpoint> allBreakpoints = debuggingModel.getBreakpoints();
      for (int i = 0; i < allBreakpoints.size(); ++i) {
        debuggerState.setBreakpoint(allBreakpoints.get(i));
      }

      debuggerState.setBreakpointsEnabled(debuggingModel.isBreakpointsEnabled());
      return true;
    } else {
      Window popup = createOrOpenPopup(appContext);
      if (popup != null) {
        popup.getLocation().assign(absoluteResourceUri);
        // Show the sidebar once to promote the Debugger Extension.
        maybeShowSidebar();
      }
      return false;
    }
  }
Пример #5
0
 public void cleanup() {
   debuggerState.shutdown();
   leftGutterClickListenerRemover.remove();
 }