com.intellij.xdebugger.XDebuggerManager Java Examples

The following examples show how to use com.intellij.xdebugger.XDebuggerManager. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: FlutterPopFrameAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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) {
    final XStackFrame frame = session.getCurrentStackFrame();
    if (frame instanceof DartVmServiceStackFrame) {
      return ((DartVmServiceStackFrame)frame);
    }
  }

  return null;
}
 
Example #2
Source File: CppBaseDebugRunner.java    From CppTools with Apache License 2.0 6 votes vote down vote up
@Nullable
@Override
protected RunContentDescriptor doExecute(Project project, RunProfileState runProfileState, RunContentDescriptor runContentDescriptor, ExecutionEnvironment env) throws ExecutionException {
  FileDocumentManager.getInstance().saveAllDocuments();

  final RunProfile runProfile = env.getRunProfile();

  final XDebugSession debugSession =
      XDebuggerManager.getInstance(project).startSession(this, env, runContentDescriptor, new XDebugProcessStarter() {
        @NotNull
        public XDebugProcess start(@NotNull final XDebugSession session) {
          return new CppDebugProcess(session, CppBaseDebugRunner.this, (BaseCppConfiguration)runProfile);
        }
      });

  return debugSession.getRunContentDescriptor();
}
 
Example #3
Source File: XBreakpointPanelProvider.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
@Nullable
public XBreakpoint<?> findBreakpoint(@Nonnull final Project project, @Nonnull final Document document, final int offset) {
  XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
  int line = document.getLineNumber(offset);
  VirtualFile file = FileDocumentManager.getInstance().getFile(document);
  if (file == null) {
    return null;
  }
  for (XLineBreakpointType<?> type : XDebuggerUtil.getInstance().getLineBreakpointTypes()) {
    XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
    if (breakpoint != null) {
      return breakpoint;
    }
  }

  return null;
}
 
Example #4
Source File: XToggleLineBreakpointActionHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public boolean isEnabled(@Nonnull final Project project, final AnActionEvent event) {
  XLineBreakpointType<?>[] breakpointTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
  final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
  for (XSourcePosition position : XDebuggerUtilImpl.getAllCaretsPositions(project, event.getDataContext())) {
    for (XLineBreakpointType<?> breakpointType : breakpointTypes) {
      final VirtualFile file = position.getFile();
      final int line = position.getLine();
      if (XLineBreakpointResolverTypeExtension.INSTANCE.resolveBreakpointType(project, file, line) != null ||
          breakpointManager.findBreakpointAtLine(breakpointType, file, line) != null) {
        return true;
      }
    }
  }
  return false;
}
 
Example #5
Source File: XMarkObjectActionHandler.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Override
public void perform(@Nonnull Project project, AnActionEvent event) {
  XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  if (session == null) return;

  XValueMarkers<?, ?> markers = ((XDebugSessionImpl)session).getValueMarkers();
  XValueNodeImpl node = XDebuggerTreeActionBase.getSelectedNode(event.getDataContext());
  if (markers == null || node == null) return;
  XValue value = node.getValueContainer();

  ValueMarkup existing = markers.getMarkup(value);
  if (existing != null) {
    markers.unmarkValue(value);
  }
  else {
    ValueMarkerPresentationDialog dialog = new ValueMarkerPresentationDialog(node.getName());
    dialog.show();
    ValueMarkup markup = dialog.getConfiguredMarkup();
    if (dialog.isOK() && markup != null) {
      markers.markValue(value, markup);
    }
  }
  session.rebuildViews();
}
 
Example #6
Source File: WeaveDebuggerRunner.java    From mule-intellij-plugins with Apache License 2.0 6 votes vote down vote up
@Nullable
protected RunContentDescriptor attachVirtualMachine(final RunProfileState state, final @NotNull ExecutionEnvironment env)
        throws ExecutionException
{

    return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter()
    {
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) throws ExecutionException
        {
            WeaveRunnerCommandLine weaveRunnerCommandLine = (WeaveRunnerCommandLine) state;
            final String weaveFile = weaveRunnerCommandLine.getModel().getWeaveFile();
            final Project project = weaveRunnerCommandLine.getEnvironment().getProject();
            final VirtualFile projectFile = project.getBaseDir();
            final String path = project.getBasePath();
            final String relativePath = weaveFile.substring(path.length());
            final VirtualFile fileByRelativePath = projectFile.findFileByRelativePath(relativePath);
            final DebuggerClient localhost = new DebuggerClient(new WeaveDebuggerClientListener(session, fileByRelativePath), new TcpClientDebuggerProtocol("localhost", 6565));
            final ExecutionResult result = state.execute(env.getExecutor(), WeaveDebuggerRunner.this);
            new DebuggerConnector(localhost).start();
            return new WeaveDebugProcess(session, localhost, result);
        }
    }).getRunContentDescriptor();

}
 
Example #7
Source File: FlutterPopFrameAction.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@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) {
    final XStackFrame frame = session.getCurrentStackFrame();
    if (frame instanceof DartVmServiceStackFrame) {
      return ((DartVmServiceStackFrame)frame);
    }
  }

  return null;
}
 
Example #8
Source File: BlazeGoDebugRunner.java    From intellij with Apache License 2.0 6 votes vote down vote up
private RunContentDescriptor doExecute(ExecutionEnvironment environment, RunProfileState state)
    throws ExecutionException {
  if (!(state instanceof BlazeGoDummyDebugProfileState)) {
    return null;
  }
  BlazeGoDummyDebugProfileState blazeState = (BlazeGoDummyDebugProfileState) state;
  GoApplicationRunningState goState = blazeState.toNativeState(environment);
  ExecutionResult executionResult = goState.execute(environment.getExecutor(), this);
  return XDebuggerManager.getInstance(environment.getProject())
      .startSession(
          environment,
          new XDebugProcessStarter() {
            @Override
            public XDebugProcess start(XDebugSession session) throws ExecutionException {
              RemoteVmConnection connection = new DlvRemoteVmConnection(true);
              XDebugProcess process =
                  new DlvDebugProcess(session, connection, executionResult, true, false);
              connection.open(goState.getDebugAddress());
              return process;
            }
          })
      .getRunContentDescriptor();
}
 
Example #9
Source File: RoboVmRunner.java    From robovm-idea with GNU General Public License v2.0 5 votes vote down vote up
@Nullable
protected RunContentDescriptor attachVirtualMachine(RunProfileState state,
                                                    @NotNull ExecutionEnvironment env,
                                                    RemoteConnection connection,
                                                    boolean pollConnection) throws ExecutionException {
    DebugEnvironment environment = new DefaultDebugUIEnvironment(env, state, connection, pollConnection).getEnvironment();
    final DebuggerSession debuggerSession = DebuggerManagerEx.getInstanceEx(env.getProject()).attachVirtualMachine(environment);
    if (debuggerSession == null) {
        return null;
    }

    final DebugProcessImpl debugProcess = debuggerSession.getProcess();
    if (debugProcess.isDetached() || debugProcess.isDetaching()) {
        debuggerSession.dispose();
        return null;
    }
    // optimization: that way BatchEvaluator will not try to lookup the class file in remote VM
    // which is an expensive operation when executed first time
    debugProcess.putUserData(BatchEvaluator.REMOTE_SESSION_KEY, Boolean.TRUE);

    return XDebuggerManager.getInstance(env.getProject()).startSession(env, new XDebugProcessStarter() {
        @Override
        @NotNull
        public XDebugProcess start(@NotNull XDebugSession session) {
            XDebugSessionImpl sessionImpl = (XDebugSessionImpl)session;
            ExecutionResult executionResult = debugProcess.getExecutionResult();
            sessionImpl.addExtraActions(executionResult.getActions());
            if (executionResult instanceof DefaultExecutionResult) {
                sessionImpl.addRestartActions(((DefaultExecutionResult)executionResult).getRestartActions());
                sessionImpl.addExtraStopActions(((DefaultExecutionResult)executionResult).getAdditionalStopActions());
            }
            return JavaDebugProcess.create(session, debuggerSession);
        }
    }).getRunContentDescriptor();
}
 
Example #10
Source File: BreakpointsFavoriteListProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void getEnabledGroupingRules(Collection<XBreakpointGroupingRule> rules) {
  rules.clear();
  XBreakpointsDialogState settings = ((XBreakpointManagerImpl)XDebuggerManager.getInstance(myProject).getBreakpointManager()).getBreakpointsDialogSettings();

  for (XBreakpointGroupingRule rule : myRulesAvailable) {
    if (rule.isAlwaysEnabled() || (settings != null && settings.getSelectedGroupingRules().contains(rule.getId()) ) ) {
      rules.add(rule);
    }
  }
}
 
Example #11
Source File: XBreakpointPanelProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void provideBreakpointItems(Project project, Collection<BreakpointItem> items) {
  final List<XBreakpointType> types = XBreakpointUtil.getBreakpointTypes();
  final XBreakpointManager manager = XDebuggerManager.getInstance(project).getBreakpointManager();
  for (XBreakpointType<?, ?> type : types) {
    final Collection<? extends XBreakpoint<?>> breakpoints = manager.getBreakpoints(type);
    if (breakpoints.isEmpty()) continue;
    for (XBreakpoint<?> breakpoint : breakpoints) {
      items.add(new XBreakpointItem(breakpoint));
    }
  }
}
 
Example #12
Source File: XBreakpointPanelProvider.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addListener(final BreakpointsListener listener, Project project, Disposable disposable) {
  XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
  final MyXBreakpointListener listener1 = new MyXBreakpointListener(listener, breakpointManager);
  breakpointManager.addBreakpointListener(listener1);
  myListeners.add(listener1);
  Disposer.register(disposable, new Disposable() {
    @Override
    public void dispose() {
      removeListener(listener);
    }
  });
}
 
Example #13
Source File: XLineBreakpointManager.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void removeBreakpoints(final List<? extends XBreakpoint<?>> toRemove) {
  if (toRemove.isEmpty()) {
    return;
  }

  ApplicationManager.getApplication().runWriteAction(() -> {
    for (XBreakpoint<?> breakpoint : toRemove) {
      XDebuggerManager.getInstance(myProject).getBreakpointManager().removeBreakpoint(breakpoint);
    }
  });
}
 
Example #14
Source File: XAddToWatchesTreeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
private static XWatchesView getWatchesView(@Nonnull AnActionEvent e) {
  XWatchesView view = e.getData(XWatchesView.DATA_KEY);
  Project project = e.getProject();
  if (view == null && project != null) {
    XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
    if (session != null) {
      XDebugSessionTab tab = ((XDebugSessionImpl)session).getSessionTab();
      if (tab != null) {
        return tab.getWatchesView();
      }
    }
  }
  return view;
}
 
Example #15
Source File: HaxeFlashDebuggingUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static RunContentDescriptor getDescriptor(final Module module,
                                                 ExecutionEnvironment env,
                                                 String urlToLaunch,
                                                 String flexSdkName) throws ExecutionException {
  final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
  if (flexSdk == null) {
    throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
  }

  final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, urlToLaunch);

  final XDebugSession debugSession =
    XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() {
      @NotNull
      public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
        try {
          final FlashRunnerParameters params = new FlashRunnerParameters();
          params.setModuleName(module.getName());
          return new HaxeDebugProcess(session, bc, params);
        }
        catch (IOException e) {
          throw new ExecutionException(e.getMessage(), e);
        }
      }
    });

  return debugSession.getRunContentDescriptor();
}
 
Example #16
Source File: HaxeFlashDebuggingUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static RunContentDescriptor getNMEDescriptor(final HaxeDebugRunner runner,
                                                    final Module module,
                                                    final ExecutionEnvironment env,
                                                    final Executor executor, String flexSdkName) throws ExecutionException {
  final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
  if (flexSdk == null) {
    throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
  }

  final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null);

  final XDebugSession debugSession =
    XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() {
      @NotNull
      public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
        try {
          NMERunningState runningState = new NMERunningState(env, module, false, true);
          final ExecutionResult executionResult = runningState.execute(executor, runner);
          final BCBasedRunnerParameters params = new BCBasedRunnerParameters();
          params.setModuleName(module.getName());
          return new HaxeDebugProcess(session, bc, params);
        }
        catch (IOException e) {
          throw new ExecutionException(e.getMessage(), e);
        }
      }
    });

  return debugSession.getRunContentDescriptor();
}
 
Example #17
Source File: HaxeFlashDebuggingUtil.java    From intellij-haxe with Apache License 2.0 5 votes vote down vote up
public static RunContentDescriptor getOpenFLDescriptor(final HaxeDebugRunner runner,
                                                       final Module module,
                                                       final ExecutionEnvironment env,
                                                       final Executor executor, String flexSdkName) throws ExecutionException {
  final Sdk flexSdk = FlexSdkUtils.findFlexOrFlexmojosSdk(flexSdkName);
  if (flexSdk == null) {
    throw new ExecutionException(HaxeBundle.message("flex.sdk.not.found", flexSdkName));
  }

  final FlexBuildConfiguration bc = new FakeFlexBuildConfiguration(flexSdk, null);

  final XDebugSession debugSession =
    XDebuggerManager.getInstance(module.getProject()).startSession(env, new XDebugProcessStarter() {
      @NotNull
      public XDebugProcess start(@NotNull final XDebugSession session) throws ExecutionException {
        try {
          OpenFLRunningState runningState = new OpenFLRunningState(env, module, false, true);
          final ExecutionResult executionResult = runningState.execute(executor, runner);
          final BCBasedRunnerParameters params = new BCBasedRunnerParameters();
          params.setModuleName(module.getName());
          return new HaxeDebugProcess(session, bc, params);
        }
        catch (IOException e) {
          throw new ExecutionException(e.getMessage(), e);
        }
      }
    });

  return debugSession.getRunContentDescriptor();
}
 
Example #18
Source File: XQueryDebuggerRunner.java    From intellij-xquery with Apache License 2.0 5 votes vote down vote up
private RunContentDescriptor createContentDescriptor(final RunProfileState runProfileState,
                                                     final ExecutionEnvironment environment) throws ExecutionException {
    XDebuggerManager debuggerManager = XDebuggerManager.getInstance(environment.getProject());
    XDebugProcessStarter processStarter = getProcessStarter(runProfileState, environment);
    final XDebugSession debugSession = debuggerManager.startSession(environment, processStarter);
    return debugSession.getRunContentDescriptor();
}
 
Example #19
Source File: ResumeAction.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected boolean isEnabled(AnActionEvent e) {
  Project project = e.getProject();
  if (project == null) return false;

  XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  if (session != null && !session.isStopped()) {
    return session.isPaused();
  }
  return !ActionPlaces.DEBUGGER_TOOLBAR.equals(e.getPlace());
}
 
Example #20
Source File: XQuickEvaluateHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public AbstractValueHint createValueHint(@Nonnull final Project project, @Nonnull final Editor editor, @Nonnull final Point point, final ValueHintType type) {
  final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  if (session == null) {
    return null;
  }

  final XDebuggerEvaluator evaluator = session.getDebugProcess().getEvaluator();
  if (evaluator == null) {
    return null;
  }

  return PsiDocumentManager.getInstance(project).commitAndRunReadAction(new Computable<XValueHint>() {
    @Override
    public XValueHint compute() {
      int offset = AbstractValueHint.calculateOffset(editor, point);
      ExpressionInfo expressionInfo = getExpressionInfo(evaluator, project, type, editor, offset);
      if (expressionInfo == null) {
        return null;
      }

      int textLength = editor.getDocument().getTextLength();
      TextRange range = expressionInfo.getTextRange();
      if (range.getStartOffset() > range.getEndOffset() || range.getStartOffset() < 0 || range.getEndOffset() > textLength) {
        LOG.error("invalid range: " + range + ", text length = " + textLength + ", evaluator: " + evaluator);
        return null;
      }

      return new XValueHint(project, editor, point, type, expressionInfo, evaluator, session);
    }
  });
}
 
Example #21
Source File: DebuggerUIUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void showXBreakpointEditorBalloon(final Project project,
                                                @Nullable final Point point,
                                                final JComponent component,
                                                final boolean showAllOptions,
                                                final XBreakpoint breakpoint) {
  final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
  final XLightBreakpointPropertiesPanel propertiesPanel =
          new XLightBreakpointPropertiesPanel(project, breakpointManager, (XBreakpointBase)breakpoint, showAllOptions);

  final Ref<Balloon> balloonRef = Ref.create(null);
  final Ref<Boolean> isLoading = Ref.create(Boolean.FALSE);
  final Ref<Boolean> moreOptionsRequested = Ref.create(Boolean.FALSE);

  propertiesPanel.setDelegate(() -> {
    if (!isLoading.get()) {
      propertiesPanel.saveProperties();
    }
    if (!balloonRef.isNull()) {
      balloonRef.get().hide();
    }
    showXBreakpointEditorBalloon(project, point, component, true, breakpoint);
    moreOptionsRequested.set(true);
  });

  isLoading.set(Boolean.TRUE);
  propertiesPanel.loadProperties();
  isLoading.set(Boolean.FALSE);

  if (moreOptionsRequested.get()) {
    return;
  }

  Runnable showMoreOptions = () -> {
    propertiesPanel.saveProperties();
    propertiesPanel.dispose();
    BreakpointsDialogFactory.getInstance(project).showDialog(breakpoint);
  };

  final JComponent mainPanel = propertiesPanel.getMainPanel();
  final Balloon balloon = showBreakpointEditor(project, mainPanel, point, component, showMoreOptions, breakpoint);
  balloonRef.set(balloon);

  final XBreakpointListener<XBreakpoint<?>> breakpointListener = new XBreakpointAdapter<XBreakpoint<?>>() {
    @Override
    public void breakpointRemoved(@Nonnull XBreakpoint<?> removedBreakpoint) {
      if (removedBreakpoint.equals(breakpoint)) {
        balloon.hide();
      }
    }
  };

  balloon.addListener(new JBPopupListener.Adapter() {
    @Override
    public void onClosed(LightweightWindowEvent event) {
      propertiesPanel.saveProperties();
      propertiesPanel.dispose();
      breakpointManager.removeBreakpointListener(breakpointListener);
    }
  });

  breakpointManager.addBreakpointListener(breakpointListener);
  ApplicationManager.getApplication().invokeLater(() -> IdeFocusManager.findInstance().requestFocus(mainPanel, true));
}
 
Example #22
Source File: XBreakpointUtil.java    From consulo with Apache License 2.0 4 votes vote down vote up
/**
 * Toggle line breakpoint with editor support:
 * - unfolds folded block on the line
 * - if folded, checks if line breakpoints could be toggled inside folded text
 */
@Nonnull
public static AsyncResult<XLineBreakpoint> toggleLineBreakpoint(@Nonnull Project project,
                                                                @Nonnull XSourcePosition position,
                                                                @Nullable Editor editor,
                                                                boolean temporary,
                                                                boolean moveCaret) {
  int lineStart = position.getLine();
  VirtualFile file = position.getFile();
  // for folded text check each line and find out type with the biggest priority
  int linesEnd = lineStart;
  if (editor != null) {
    FoldRegion region = FoldingUtil.findFoldRegionStartingAtLine(editor, lineStart);
    if (region != null && !region.isExpanded()) {
      linesEnd = region.getDocument().getLineNumber(region.getEndOffset());
    }
  }

  final XBreakpointManager breakpointManager = XDebuggerManager.getInstance(project).getBreakpointManager();
  XLineBreakpointType<?>[] lineTypes = XDebuggerUtil.getInstance().getLineBreakpointTypes();
  XLineBreakpointType<?> typeWinner = null;
  int lineWinner = -1;
  for (int line = lineStart; line <= linesEnd; line++) {
    for (XLineBreakpointType<?> type : lineTypes) {
      final XLineBreakpoint<? extends XBreakpointProperties> breakpoint = breakpointManager.findBreakpointAtLine(type, file, line);
      if (breakpoint != null && temporary && !breakpoint.isTemporary()) {
        breakpoint.setTemporary(true);
      }
      else if(breakpoint != null) {
        typeWinner = type;
        lineWinner = line;
        break;
      }
    }

    XLineBreakpointType<?> breakpointType = XLineBreakpointResolverTypeExtension.INSTANCE.resolveBreakpointType(project, file, line);
    if(breakpointType != null) {
      typeWinner = breakpointType;
      lineWinner = line;
    }

    // already found max priority type - stop
    if (typeWinner != null) {
      break;
    }
  }

  if (typeWinner != null) {
    XSourcePosition winPosition = (lineStart == lineWinner) ? position : XSourcePositionImpl.create(file, lineWinner);
    if (winPosition != null) {
      AsyncResult<XLineBreakpoint> res =
              XDebuggerUtilImpl.toggleAndReturnLineBreakpoint(project, typeWinner, winPosition, temporary, editor);

      if (editor != null && lineStart != lineWinner) {
        int offset = editor.getDocument().getLineStartOffset(lineWinner);
        ExpandRegionAction.expandRegionAtOffset(project, editor, offset);
        if (moveCaret) {
          editor.getCaretModel().moveToOffset(offset);
        }
      }
      return res;
    }
  }

  return AsyncResult.rejected();
}
 
Example #23
Source File: BreakpointsDialog.java    From consulo with Apache License 2.0 4 votes vote down vote up
private XBreakpointManagerImpl getBreakpointManager() {
  return (XBreakpointManagerImpl)XDebuggerManager.getInstance(myProject).getBreakpointManager();
}
 
Example #24
Source File: TestExecutionState.java    From buck with Apache License 2.0 4 votes vote down vote up
private void attachDebugger(String title, String port) {
  final RemoteConnection remoteConnection =
      new RemoteConnection(/* useSockets */ true, "localhost", port, /* serverMode */ false);
  final RemoteStateState state = new RemoteStateState(mProject, remoteConnection);
  final String name = title + " debugger (" + port + ")";
  final ConfigurationFactory cfgFactory =
      ConfigurationTypeUtil.findConfigurationType("Remote").getConfigurationFactories()[0];
  RunnerAndConfigurationSettings runSettings =
      RunManager.getInstance(mProject).createRunConfiguration(name, cfgFactory);
  final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
  final ExecutionEnvironment env =
      new ExecutionEnvironmentBuilder(mProject, debugExecutor)
          .runProfile(runSettings.getConfiguration())
          .build();
  final int pollTimeout = 3000;
  final DebugEnvironment environment =
      new DefaultDebugEnvironment(env, state, remoteConnection, pollTimeout);

  ApplicationManager.getApplication()
      .invokeLater(
          () -> {
            try {
              final DebuggerSession debuggerSession =
                  DebuggerManagerEx.getInstanceEx(mProject).attachVirtualMachine(environment);
              if (debuggerSession == null) {
                return;
              }
              XDebuggerManager.getInstance(mProject)
                  .startSessionAndShowTab(
                      name,
                      null,
                      new XDebugProcessStarter() {
                        @Override
                        @NotNull
                        public XDebugProcess start(@NotNull XDebugSession session) {
                          return JavaDebugProcess.create(session, debuggerSession);
                        }
                      });
            } catch (ExecutionException e) {
              LOG.error(
                  "failed to attach to debugger on port "
                      + port
                      + " with polling timeout "
                      + pollTimeout);
            }
          });
}
 
Example #25
Source File: TestConsoleProperties.java    From consulo with Apache License 2.0 4 votes vote down vote up
public boolean isPaused() {
  XDebugSession debuggerSession = XDebuggerManager.getInstance(myProject).getDebugSession(getConsole());
  return debuggerSession != null && debuggerSession.isPaused();
}
 
Example #26
Source File: XQuickEvaluateHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isEnabled(@Nonnull final Project project) {
  XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  return session != null && session.getDebugProcess().getEvaluator() != null;
}
 
Example #27
Source File: XDebuggerSupport.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public AbstractDebuggerSession getCurrentSession(@Nonnull Project project) {
  return XDebuggerManager.getInstance(project).getCurrentSession();
}
 
Example #28
Source File: XDebuggerToggleActionHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
public boolean isSelected(@Nonnull final Project project, final AnActionEvent event) {
  XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  return session != null && isSelected(session, event);
}
 
Example #29
Source File: XDebuggerPauseActionHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public boolean isHidden(@Nonnull Project project, AnActionEvent event) {
  final XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  return session == null || !((XDebugSessionImpl)session).isPauseActionSupported();
}
 
Example #30
Source File: XMarkObjectActionHandler.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Nullable
private static XValueMarkers<?, ?> getValueMarkers(@Nonnull Project project) {
  XDebugSession session = XDebuggerManager.getInstance(project).getCurrentSession();
  return session != null ? ((XDebugSessionImpl)session).getValueMarkers() : null;
}