Example #1
0
    protected void commandCancelled() {
      if (!DebuggerManagerThreadImpl.isManagerThread()) {
        return;
      }
      // context thread is not suspended
      final DebuggerContextImpl context = getDebuggerContext();

      final SuspendContextImpl suspendContext = context.getSuspendContext();
      if (suspendContext == null) {
        return;
      }
      final ThreadReferenceProxyImpl threadToSelect = context.getThreadProxy();
      if (threadToSelect == null) {
        return;
      }

      if (!suspendContext.isResumed()) {
        final SuspendContextImpl threadContext =
            SuspendManagerUtil.getSuspendContextForThread(suspendContext, threadToSelect);
        context
            .getDebugProcess()
            .getManagerThread()
            .schedule(new RebuildFramesListCommand(context, threadContext));
        refillThreadsCombo(threadToSelect);
      }
    }
Example #2
0
    public void threadAction() {
      if (myRefreshOnly && myThreadDescriptorsToUpdate.length != myThreadsCombo.getItemCount()) {
        // there is no sense in refreshing combobox if thread list has changed since creation of
        // this command
        return;
      }

      final DebuggerContextImpl context = getDebuggerContext();

      final ThreadReferenceProxyImpl threadToSelect = context.getThreadProxy();
      if (threadToSelect == null) {
        return;
      }

      final SuspendContextImpl threadContext =
          SuspendManagerUtil.getSuspendContextForThread(
              context.getSuspendContext(), threadToSelect);
      final ThreadDescriptorImpl currentThreadDescriptor =
          (ThreadDescriptorImpl) myThreadsCombo.getSelectedItem();
      final ThreadReferenceProxyImpl currentThread =
          currentThreadDescriptor != null ? currentThreadDescriptor.getThreadReference() : null;

      if (myRefreshOnly && threadToSelect.equals(currentThread)) {
        context
            .getDebugProcess()
            .getManagerThread()
            .schedule(new UpdateFramesListCommand(context, threadContext));
      } else {
        context
            .getDebugProcess()
            .getManagerThread()
            .schedule(new RebuildFramesListCommand(context, threadContext));
      }

      if (myRefreshOnly) {
        final EvaluationContextImpl evaluationContext = context.createEvaluationContext();
        for (ThreadDescriptorImpl descriptor : myThreadDescriptorsToUpdate) {
          descriptor.setContext(evaluationContext);
          descriptor.updateRepresentation(
              evaluationContext, DescriptorLabelListener.DUMMY_LISTENER);
        }
        DebuggerInvocationUtil.swingInvokeLater(
            getProject(),
            new Runnable() {
              public void run() {
                try {
                  myThreadsListener.setEnabled(false);
                  selectThread(threadToSelect);
                  myFramesList.repaint();
                } finally {
                  myThreadsListener.setEnabled(true);
                }
              }
            });
      } else { // full rebuild
        refillThreadsCombo(threadToSelect);
      }
    }