com.intellij.xdebugger.impl.XDebugSessionImpl Java Examples

The following examples show how to use com.intellij.xdebugger.impl.XDebugSessionImpl. 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: VmServiceWrapper.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void attachIsolate(@NotNull IsolateRef isolateRef, @NotNull Isolate isolate) {
  final boolean newIsolate = myIsolatesInfo.addIsolate(isolateRef);
  // Just to make sure that the main isolate is not handled twice, both from handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
  if (newIsolate) {
    final XDebugSessionImpl session = (XDebugSessionImpl)myDebugProcess.getSession();
    ApplicationManager.getApplication().runReadAction(() -> {
      session.reset();
      session.initBreakpoints();
    });
    addRequest(() -> myVmService.setExceptionPauseMode(isolateRef.getId(),
                                                       myDebugProcess.getBreakOnExceptionMode(),
                                                       new VmServiceConsumers.SuccessConsumerWrapper() {
                                                         @Override
                                                         public void received(Success response) {
                                                           setInitialBreakpointsAndCheckExtensions(isolateRef, isolate);
                                                         }
                                                       }));
  }
}
 
Example #2
Source File: XWatchesViewImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
public void updateSessionData() {
  List<XExpression> watchExpressions = ContainerUtil.newArrayList();
  List<? extends WatchNode> children = myRootNode.getWatchChildren();
  for (WatchNode child : children) {
    watchExpressions.add(child.getExpression());
  }
  XDebugSession session = getSession(getTree());
  XExpression[] expressions = watchExpressions.toArray(new XExpression[watchExpressions.size()]);
  if (session != null) {
    ((XDebugSessionImpl)session).setWatchExpressions(expressions);
  }
  else {
    XDebugSessionData data = getData(XDebugSessionData.DATA_KEY, getTree());
    if (data != null) {
      data.setWatchExpressions(expressions);
    }
  }
}
 
Example #3
Source File: XWatchesViewImpl.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
private XExpression[] getExpressions() {
  XDebuggerTree tree = getTree();
  XDebugSession session = getSession(tree);
  XExpression[] expressions;
  if (session != null) {
    expressions = ((XDebugSessionImpl)session).getSessionData().getWatchExpressions();
  }
  else {
    XDebuggerTreeNode root = tree.getRoot();
    List<? extends WatchNode> current = root instanceof WatchesRootNode
                                        ? ((WatchesRootNode)tree.getRoot()).getWatchChildren() : Collections.emptyList();
    List<XExpression> list = ContainerUtil.newArrayList();
    for (WatchNode child : current) {
      list.add(child.getExpression());
    }
    expressions = list.toArray(new XExpression[list.size()]);
  }
  return expressions;
}
 
Example #4
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
private static void showView(@Nonnull XDebugSessionImpl session, String viewId) {
  XDebugSessionTab tab = session.getSessionTab();
  if (tab != null) {
    tab.toFront(false, null);
    // restore watches tab if minimized
    tab.restoreContent(viewId);

    JComponent component = tab.getUi().getComponent();
    if (component instanceof DataProvider) {
      RunnerContentUi ui = ((DataProvider)component).getDataUnchecked(RunnerContentUi.KEY);
      if (ui != null) {
        Content content = ui.findContent(viewId);

        // if the view is not visible (e.g. Console tab is selected, while Debugger tab is not)
        // make sure we make it visible to the user
        if (content != null) {
          ui.select(content, false);
        }
      }
    }
  }
}
 
Example #5
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
private Content createVariablesContent(@Nonnull XDebugSessionImpl session) {
  XVariablesView variablesView;
  if (myWatchesInVariables) {
    variablesView = myWatchesView = new XWatchesViewImpl(session, myWatchesInVariables);
  }
  else {
    variablesView = new XVariablesView(session);
  }
  registerView(DebuggerContentInfo.VARIABLES_CONTENT, variablesView);
  Content result =
          myUi.createContent(DebuggerContentInfo.VARIABLES_CONTENT, variablesView.getPanel(), XDebuggerBundle.message("debugger.session.tab.variables.title"),
                             AllIcons.Debugger.Value, null);
  result.setCloseable(false);

  ActionGroup group = getCustomizedActionGroup(XDebuggerActions.VARIABLES_TREE_TOOLBAR_GROUP);
  result.setActions(group, ActionPlaces.DEBUGGER_TOOLBAR, variablesView.getTree());
  return result;
}
 
Example #6
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
private void setSession(@Nonnull XDebugSessionImpl session, @Nullable ExecutionEnvironment environment, @Nullable Image icon) {
  myEnvironment = environment;
  mySession = session;
  mySessionData = session.getSessionData();
  myConsole = session.getConsoleView();

  AnAction[] restartActions;
  List<AnAction> restartActionsList = session.getRestartActions();
  if (ContainerUtil.isEmpty(restartActionsList)) {
    restartActions = AnAction.EMPTY_ARRAY;
  }
  else {
    restartActions = restartActionsList.toArray(new AnAction[restartActionsList.size()]);
  }

  myRunContentDescriptor =
          new RunContentDescriptor(myConsole, session.getDebugProcess().getProcessHandler(), myUi.getComponent(), session.getSessionName(), icon,
                                   myRebuildWatchesRunnable, restartActions);
  Disposer.register(myRunContentDescriptor, this);
  Disposer.register(myProject, myRunContentDescriptor);
}
 
Example #7
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
private XDebugSessionTab(@Nonnull XDebugSessionImpl session, @Nullable Image icon, @Nullable ExecutionEnvironment environment) {
  super(session.getProject(), "Debug", session.getSessionName(), GlobalSearchScope.allScope(session.getProject()));

  setSession(session, environment, icon);

  myUi.addContent(createFramesContent(), 0, PlaceInGrid.left, false);
  addVariablesAndWatches(session);

  attachToSession(session);

  DefaultActionGroup focus = new DefaultActionGroup();
  focus.add(ActionManager.getInstance().getAction(XDebuggerActions.FOCUS_ON_BREAKPOINT));
  myUi.getOptions().setAdditionalFocusActions(focus);

  myUi.addListener(new ContentManagerAdapter() {
    @Override
    public void selectionChanged(ContentManagerEvent event) {
      Content content = event.getContent();
      if (mySession != null && content.isSelected() && getWatchesContentId().equals(ViewImpl.ID.get(content))) {
        myRebuildWatchesRunnable.run();
      }
    }
  }, myRunContentDescriptor);

  rebuildViews();
}
 
Example #8
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 6 votes vote down vote up
@Nonnull
public static XDebugSessionTab create(@Nonnull XDebugSessionImpl session,
                                      @Nullable Image icon,
                                      @Nullable ExecutionEnvironment environment,
                                      @Nullable RunContentDescriptor contentToReuse) {
  if (contentToReuse != null && SystemProperties.getBooleanProperty("xdebugger.reuse.session.tab", false)) {
    JComponent component = contentToReuse.getComponent();
    if (component != null) {
      XDebugSessionTab oldTab = DataManager.getInstance().getDataContext(component).getData(TAB_KEY);
      if (oldTab != null) {
        oldTab.setSession(session, environment, icon);
        oldTab.attachToSession(session);
        return oldTab;
      }
    }
  }
  XDebugSessionTab tab = new XDebugSessionTab(session, icon, environment);
  tab.myRunContentDescriptor.setActivateToolWindowWhenAdded(contentToReuse == null || contentToReuse.isActivateToolWindowWhenAdded());
  return tab;
}
 
Example #9
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 #10
Source File: VmServiceWrapper.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
public void attachIsolate(@NotNull IsolateRef isolateRef, @NotNull Isolate isolate) {
  final boolean newIsolate = myIsolatesInfo.addIsolate(isolateRef);
  // Just to make sure that the main isolate is not handled twice, both from handleDebuggerConnected() and DartVmServiceListener.received(PauseStart)
  if (newIsolate) {
    final XDebugSessionImpl session = (XDebugSessionImpl)myDebugProcess.getSession();
    ApplicationManager.getApplication().runReadAction(() -> {
      session.reset();
      session.initBreakpoints();
    });
    addRequest(() -> myVmService.setExceptionPauseMode(isolateRef.getId(),
                                                       myDebugProcess.getBreakOnExceptionMode(),
                                                       new VmServiceConsumers.SuccessConsumerWrapper() {
                                                         @Override
                                                         public void received(Success response) {
                                                           setInitialBreakpointsAndCheckExtensions(isolateRef, isolate);
                                                         }
                                                       }));
  }
}
 
Example #11
Source File: BlazeHotSwapManager.java    From intellij with Apache License 2.0 6 votes vote down vote up
@Nullable
static HotSwappableDebugSession findHotSwappableBlazeDebuggerSession(Project project) {
  DebuggerManagerEx debuggerManager = DebuggerManagerEx.getInstanceEx(project);
  DebuggerSession session = debuggerManager.getContext().getDebuggerSession();
  if (session == null || !session.isAttached()) {
    return null;
  }
  JavaDebugProcess process = session.getProcess().getXdebugProcess();
  if (process == null) {
    return null;
  }
  ExecutionEnvironment env = ((XDebugSessionImpl) process.getSession()).getExecutionEnvironment();
  if (env == null || ClassFileManifestBuilder.getManifest(env) == null) {
    return null;
  }
  RunProfile runProfile = env.getRunProfile();
  if (!(runProfile instanceof BlazeCommandRunConfiguration)) {
    return null;
  }
  return new HotSwappableDebugSession(session, env, (BlazeCommandRunConfiguration) runProfile);
}
 
Example #12
Source File: XDebuggerTestUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
public static void disposeDebugSession(final XDebugSession debugSession) {
  WriteAction.run(() -> {
    XDebugSessionImpl session = (XDebugSessionImpl)debugSession;
    Disposer.dispose(session.getSessionTab());
    Disposer.dispose(session.getConsoleView());
  });
}
 
Example #13
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 #14
Source File: HeadlessValueEvaluationCallback.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void errorOccurred(@Nonnull String errorMessage) {
  try {
    String message = XDebuggerBundle.message("load.value.task.error", errorMessage);
    XDebugSessionImpl.NOTIFICATION_GROUP.createNotification(message, NotificationType.ERROR).notify(myNode.getTree().getProject());
  }
  finally {
    evaluationComplete(errorMessage);
  }
}
 
Example #15
Source File: XAddToWatchesFromEditorActionHandler.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
protected void perform(@Nonnull XDebugSession session, DataContext dataContext) {
  final String text = getTextToEvaluate(dataContext, session);
  if (text == null) return;

  ((XDebugSessionImpl)session).getSessionTab().getWatchesView().addWatchExpression(XExpressionImpl.fromText(text), -1, true);
}
 
Example #16
Source File: XDebuggerEvaluationDialog.java    From consulo with Apache License 2.0 5 votes vote down vote up
private void addToWatches() {
  if (myMode == EvaluationMode.EXPRESSION) {
    XExpression expression = getInputEditor().getExpression();
    if (!XDebuggerUtilImpl.isEmptyExpression(expression)) {
      XDebugSessionTab tab = ((XDebugSessionImpl)mySession).getSessionTab();
      if (tab != null) {
        tab.getWatchesView().addWatchExpression(expression, -1, true);
        getInputEditor().requestFocusInEditor();
      }
    }
  }
}
 
Example #17
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 5 votes vote down vote up
private Content createWatchesContent(@Nonnull XDebugSessionImpl session) {
  myWatchesView = new XWatchesViewImpl(session, myWatchesInVariables);
  registerView(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView);
  Content watchesContent =
          myUi.createContent(DebuggerContentInfo.WATCHES_CONTENT, myWatchesView.getPanel(), XDebuggerBundle.message("debugger.session.tab.watches.title"),
                             AllIcons.Debugger.Watches, null);
  watchesContent.setCloseable(false);
  return watchesContent;
}
 
Example #18
Source File: XWatchesViewImpl.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void addWatchExpression(@Nonnull XExpression expression, int index, final boolean navigateToWatchNode) {
  XDebugSession session = getSession(getTree());
  myRootNode.addWatchExpression(session != null ? session.getCurrentStackFrame() : null, expression, index, navigateToWatchNode);
  updateSessionData();
  if (navigateToWatchNode && session != null) {
    XDebugSessionTab.showWatchesView((XDebugSessionImpl)session);
  }
}
 
Example #19
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 #20
Source File: XBreakpointBase.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nullable
public String getErrorMessage() {
  final XDebugSessionImpl currentSession = getBreakpointManager().getDebuggerManager().getCurrentSession();
  if (currentSession != null) {
    CustomizedBreakpointPresentation presentation = currentSession.getBreakpointPresentation(this);
    if (presentation != null) {
      final String message = presentation.getErrorMessage();
      if (message != null) return message;
    }
  }
  return myCustomizedPresentation != null ? myCustomizedPresentation.getErrorMessage() : null;
}
 
Example #21
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
private static void attachViewToSession(@Nonnull XDebugSessionImpl session, @Nullable XDebugView view) {
  if (view != null) {
    session.addSessionListener(new XDebugViewSessionListener(view, session), view);
  }
}
 
Example #22
Source File: XFramesView.java    From consulo with Apache License 2.0 4 votes vote down vote up
@Override
public void processSessionEvent(@Nonnull SessionEvent event, @Nonnull XDebugSession session) {
  myRefresh = event == SessionEvent.SETTINGS_CHANGED;

  if (event == SessionEvent.BEFORE_RESUME) {
    return;
  }

  XExecutionStack currentExecutionStack = ((XDebugSessionImpl)session).getCurrentExecutionStack();
  XStackFrame currentStackFrame = session.getCurrentStackFrame();
  XSuspendContext suspendContext = session.getSuspendContext();

  if (event == SessionEvent.FRAME_CHANGED && Objects.equals(mySelectedStack, currentExecutionStack)) {
    ApplicationManager.getApplication().assertIsDispatchThread();
    if (currentStackFrame != null) {
      myFramesList.setSelectedValue(currentStackFrame, true);
      mySelectedFrameIndex = myFramesList.getSelectedIndex();
      myExecutionStacksWithSelection.put(mySelectedStack, mySelectedFrameIndex);
    }
    return;
  }

  EdtExecutorService.getInstance().execute(() -> {
    if (event != SessionEvent.SETTINGS_CHANGED) {
      mySelectedFrameIndex = 0;
      mySelectedStack = null;
      myVisibleRect = null;
    }
    else {
      myVisibleRect = myFramesList.getVisibleRect();
    }

    myListenersEnabled = false;
    myBuilders.values().forEach(StackFramesListBuilder::dispose);
    myBuilders.clear();

    if (suspendContext == null) {
      requestClear();
      return;
    }

    if (event == SessionEvent.PAUSED) {
      // clear immediately
      cancelClear();
      clear();
    }

    XExecutionStack activeExecutionStack = mySelectedStack != null ? mySelectedStack : currentExecutionStack;
    addExecutionStacks(Collections.singletonList(activeExecutionStack));

    XExecutionStack[] executionStacks = suspendContext.getExecutionStacks();
    addExecutionStacks(Arrays.asList(executionStacks));

    myThreadComboBox.setSelectedItem(activeExecutionStack);
    myThreadsPanel.removeAll();
    myThreadsPanel.add(myToolbar.getComponent(), BorderLayout.EAST);
    final boolean invisible = executionStacks.length == 1 && StringUtil.isEmpty(executionStacks[0].getDisplayName());
    if (!invisible) {
      myThreadsPanel.add(myThreadComboBox, BorderLayout.CENTER);
    }
    updateFrames(activeExecutionStack, session, event == SessionEvent.FRAME_CHANGED ? currentStackFrame : null);
  });
}
 
Example #23
Source File: XVariablesView.java    From consulo with Apache License 2.0 4 votes vote down vote up
public XVariablesView(@Nonnull XDebugSessionImpl session) {
  super(session.getProject(), session.getDebugProcess().getEditorsProvider(), session.getValueMarkers());
  myComponent = new BorderLayoutPanel();
  myComponent.add(super.getPanel());
  DataManager.registerDataProvider(myComponent, this);
}
 
Example #24
Source File: XWatchesViewImpl.java    From consulo with Apache License 2.0 4 votes vote down vote up
public XWatchesViewImpl(@Nonnull XDebugSessionImpl session, boolean watchesInVariables) {
  super(session);
  myWatchesInVariables = watchesInVariables;

  XDebuggerTree tree = getTree();
  createNewRootNode(null);

  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XNEW_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XREMOVE_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XCOPY_WATCH, tree, myDisposables);
  DebuggerUIUtil.registerActionOnComponent(XDebuggerActions.XEDIT_WATCH, tree, myDisposables);

  EmptyAction.registerWithShortcutSet(XDebuggerActions.XNEW_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.ADD), tree);
  EmptyAction.registerWithShortcutSet(XDebuggerActions.XREMOVE_WATCH,
                                      CommonActionsPanel.getCommonShortcut(CommonActionsPanel.Buttons.REMOVE), tree);

  DnDManager.getInstance().registerTarget(this, tree);

  new AnAction() {
    @Override
    public void actionPerformed(@Nonnull AnActionEvent e) {
      Object contents = CopyPasteManager.getInstance().getContents(XWatchTransferable.EXPRESSIONS_FLAVOR);
      if (contents instanceof List) {
        for (Object item : ((List)contents)){
          if (item instanceof XExpression) {
            addWatchExpression(((XExpression)item), -1, true);
          }
        }
      }
    }
  }.registerCustomShortcutSet(CommonShortcuts.getPaste(), tree, myDisposables);

  ActionToolbarImpl toolbar = (ActionToolbarImpl)ActionManager.getInstance().createActionToolbar(
          ActionPlaces.DEBUGGER_TOOLBAR,
          DebuggerSessionTabBase.getCustomizedActionGroup(XDebuggerActions.WATCHES_TREE_TOOLBAR_GROUP),
          !myWatchesInVariables);
  toolbar.setBorder(new CustomLineBorder(UIUtil.getBorderColor(), 0, 0,
                                         myWatchesInVariables ? 0 : 1,
                                         myWatchesInVariables ? 1 : 0));
  toolbar.setTargetComponent(tree);

  if (!myWatchesInVariables) {
    getTree().getEmptyText().setText(XDebuggerBundle.message("debugger.no.watches"));
  }
  getPanel().add(toolbar.getComponent(), myWatchesInVariables ? BorderLayout.WEST : BorderLayout.NORTH);

  installEditListeners();
}
 
Example #25
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void showFramesView(@Nonnull XDebugSessionImpl session) {
  showView(session, DebuggerContentInfo.FRAME_CONTENT);
}
 
Example #26
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static void showWatchesView(@Nonnull XDebugSessionImpl session) {
  XDebugSessionTab tab = session.getSessionTab();
  if (tab != null) {
    showView(session, tab.getWatchesContentId());
  }
}
 
Example #27
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;
}
 
Example #28
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void attachToSession(@Nonnull XDebugSessionImpl session) {
  for (XDebugView view : myViews.values()) {
    attachViewToSession(session, view);
  }

  XDebugTabLayouter layouter = session.getDebugProcess().createTabLayouter();
  Content consoleContent = layouter.registerConsoleContent(myUi, myConsole);
  attachNotificationTo(consoleContent);

  layouter.registerAdditionalContent(myUi);
  RunContentBuilder.addAdditionalConsoleEditorActions(myConsole, consoleContent);

  if (ApplicationManager.getApplication().isUnitTestMode()) {
    return;
  }

  DefaultActionGroup leftToolbar = new DefaultActionGroup();
  final Executor debugExecutor = DefaultDebugExecutor.getDebugExecutorInstance();
  if (myEnvironment != null) {
    leftToolbar.add(ActionManager.getInstance().getAction(IdeActions.ACTION_RERUN));
    List<AnAction> additionalRestartActions = session.getRestartActions();
    if (!additionalRestartActions.isEmpty()) {
      leftToolbar.addAll(additionalRestartActions);
      leftToolbar.addSeparator();
    }
    leftToolbar.addAll(session.getExtraActions());
  }
  leftToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_LEFT_TOOLBAR_GROUP));

  for (AnAction action : session.getExtraStopActions()) {
    leftToolbar.add(action, new Constraints(Anchor.AFTER, IdeActions.ACTION_STOP_PROGRAM));
  }

  //group.addSeparator();
  //addAction(group, DebuggerActions.EXPORT_THREADS);
  leftToolbar.addSeparator();

  leftToolbar.add(myUi.getOptions().getLayoutActions());
  final AnAction[] commonSettings = myUi.getOptions().getSettingsActionsList();
  DefaultActionGroup settings = new DefaultActionGroup(ActionsBundle.message("group.XDebugger.settings.text"), true);
  settings.getTemplatePresentation().setIcon(myUi.getOptions().getSettingsActions().getTemplatePresentation().getIcon());
  settings.addAll(commonSettings);
  leftToolbar.add(settings);

  leftToolbar.addSeparator();

  leftToolbar.add(PinToolwindowTabAction.getPinAction());

  DefaultActionGroup topToolbar = new DefaultActionGroup();
  topToolbar.addAll(getCustomizedActionGroup(XDebuggerActions.TOOL_WINDOW_TOP_TOOLBAR_GROUP));

  session.getDebugProcess().registerAdditionalActions(leftToolbar, topToolbar, settings);
  myUi.getOptions().setLeftToolbar(leftToolbar, ActionPlaces.DEBUGGER_TOOLBAR);
  myUi.getOptions().setTopToolbar(topToolbar, ActionPlaces.DEBUGGER_TOOLBAR);

  if (myEnvironment != null) {
    initLogConsoles(myEnvironment.getRunProfile(), myRunContentDescriptor, myConsole);
  }
}
 
Example #29
Source File: XValueHint.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void showTree(@Nonnull XValue value) {
  XValueMarkers<?,?> valueMarkers = ((XDebugSessionImpl)myDebugSession).getValueMarkers();
  XDebuggerTreeCreator creator = new XDebuggerTreeCreator(myDebugSession.getProject(), myDebugSession.getDebugProcess().getEditorsProvider(),
                                                          myDebugSession.getCurrentPosition(), valueMarkers);
  showTreePopup(creator, Pair.create(value, myValueName));
}
 
Example #30
Source File: XDebugSessionTab.java    From consulo with Apache License 2.0 4 votes vote down vote up
private void addVariablesAndWatches(@Nonnull XDebugSessionImpl session) {
  myUi.addContent(createVariablesContent(session), 0, PlaceInGrid.center, false);
  if (!myWatchesInVariables) {
    myUi.addContent(createWatchesContent(session), 0, PlaceInGrid.right, false);
  }
}