public void actionPerformed(final AnActionEvent e) {
    DebuggerTreeNodeImpl[] selectedNode = getSelectedNodes(e.getDataContext());
    final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();

    if (debugProcess == null) return;

    //noinspection ConstantConditions
    for (final DebuggerTreeNodeImpl debuggerTreeNode : selectedNode) {
      final ThreadDescriptorImpl threadDescriptor =
          ((ThreadDescriptorImpl) debuggerTreeNode.getDescriptor());

      if (threadDescriptor.isSuspended()) {
        final ThreadReferenceProxyImpl thread = threadDescriptor.getThreadReference();
        debugProcess
            .getManagerThread()
            .schedule(
                new DebuggerCommandImpl() {
                  @Override
                  protected void action() throws Exception {
                    Set<SuspendContextImpl> contexts =
                        SuspendManagerUtil.getSuspendingContexts(
                            debugProcess.getSuspendManager(), thread);
                    if (!contexts.isEmpty()) {
                      debugProcess
                          .createResumeThreadCommand(contexts.iterator().next(), thread)
                          .run();
                    }
                    debuggerTreeNode.calcValue();
                  }
                });
      }
    }
  }
  @Override
  public void update(final AnActionEvent e) {
    if (!isFirstStart(e)) {
      return;
    }

    final DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null) {
      e.getPresentation().setVisible(false);
      return;
    }

    DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
    if (selectedNode == null) {
      e.getPresentation().setVisible(false);
      return;
    }

    final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
    if (descriptor instanceof ValueDescriptor) {
      debugProcess
          .getManagerThread()
          .schedule(
              new EnableCommand(debuggerContext, (ValueDescriptor) descriptor, debugProcess, e));
    } else {
      e.getPresentation().setVisible(false);
    }
  }
 @Override
 public final void contextAction() throws Exception {
   try {
     doAction(calcPosition(myDescriptor, myDebugProcess));
   } catch (ClassNotLoadedException ex) {
     final String className = ex.className();
     if (loadClass(className) != null) {
       myDebugProcess.getManagerThread().schedule(createRetryCommand());
     }
   }
 }
Example #4
0
  /*invoked in swing thread*/
  protected void rebuild(final boolean updateOnly) {
    if (!updateOnly) {
      myThreadsCombo.removeAllItems();
      synchronized (myFramesList) {
        myFramesList.clear();
      }
    }

    final DebugProcessImpl process = getContext().getDebugProcess();
    if (process != null) {
      process
          .getManagerThread()
          .schedule(new RefreshFramePanelCommand(updateOnly && myThreadsCombo.getItemCount() != 0));
    }
  }
  public void actionPerformed(AnActionEvent e) {
    final Project project = CommonDataKeys.PROJECT.getData(e.getDataContext());
    if (project == null) {
      return;
    }
    DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();

    final DebuggerSession session = context.getDebuggerSession();
    if (session != null && session.isAttached()) {
      final DebugProcessImpl process = context.getDebugProcess();
      process
          .getManagerThread()
          .invoke(
              new DebuggerCommandImpl() {
                protected void action() throws Exception {
                  final VirtualMachineProxyImpl vm = process.getVirtualMachineProxy();
                  vm.suspend();
                  try {
                    final List<ThreadState> threads = buildThreadStates(vm);
                    ApplicationManager.getApplication()
                        .invokeLater(
                            new Runnable() {
                              public void run() {
                                XDebugSession xSession = session.getProcess().getXDebugSession();
                                if (xSession != null) {
                                  DebuggerSessionTab.addThreadDump(
                                      project, threads, xSession.getUI(), session);
                                }
                              }
                            },
                            ModalityState.NON_MODAL);
                  } finally {
                    vm.resume();
                  }
                }
              });
    }
  }
  @Override
  public void actionPerformed(AnActionEvent e) {
    DebuggerTreeNodeImpl selectedNode = getSelectedNode(e.getDataContext());
    if (selectedNode == null) {
      return;
    }

    final NodeDescriptorImpl descriptor = selectedNode.getDescriptor();
    if (!(descriptor instanceof ValueDescriptor)) {
      return;
    }

    DebuggerContextImpl debuggerContext = getDebuggerContext(e.getDataContext());
    final DebugProcessImpl debugProcess = debuggerContext.getDebugProcess();
    if (debugProcess == null) {
      return;
    }

    debugProcess
        .getManagerThread()
        .schedule(
            new NavigateCommand(debuggerContext, (ValueDescriptor) descriptor, debugProcess, e));
  }
Example #7
0
  public void actionPerformed(AnActionEvent e) {
    final Project project = PlatformDataKeys.PROJECT.getData(e.getDataContext());
    if (project == null) {
      return;
    }
    DebuggerContextImpl context = (DebuggerManagerEx.getInstanceEx(project)).getContext();

    if (context.getDebuggerSession() != null) {
      final DebugProcessImpl process = context.getDebugProcess();
      process
          .getManagerThread()
          .invoke(
              new DebuggerCommandImpl() {
                protected void action() throws Exception {
                  final VirtualMachineProxyImpl vm = process.getVirtualMachineProxy();
                  vm.suspend();
                  try {
                    final List<ThreadState> threads = buildThreadStates(vm);
                    ApplicationManager.getApplication()
                        .invokeLater(
                            new Runnable() {
                              public void run() {
                                final DebuggerSessionTab sessionTab =
                                    DebuggerPanelsManager.getInstance(project).getSessionTab();
                                if (sessionTab != null) {
                                  sessionTab.addThreadDump(threads);
                                }
                              }
                            },
                            ModalityState.NON_MODAL);
                  } finally {
                    vm.resume();
                  }
                }
              });
    }
  }