public void invokeCommand(final DebuggerCommand command) {
    if (command instanceof SuspendContextCommand) {
      SuspendContextCommand suspendContextCommand = (SuspendContextCommand) command;
      schedule(
          new SuspendContextCommandImpl(
              (SuspendContextImpl) suspendContextCommand.getSuspendContext()) {
            public void contextAction() throws Exception {
              command.action();
            }

            protected void commandCancelled() {
              command.commandCancelled();
            }
          });
    } else {
      schedule(
          new DebuggerCommandImpl() {
            protected void action() throws Exception {
              command.action();
            }

            protected void commandCancelled() {
              command.commandCancelled();
            }
          });
    }
  }
 public void invoke(DebuggerCommandImpl managerCommand) {
   if (currentThread() instanceof DebuggerManagerThreadImpl) {
     processEvent(managerCommand);
   } else {
     schedule(managerCommand);
   }
 }
Beispiel #3
0
    public void contextAction() throws Exception {
      final ThreadReferenceProxyImpl thread = myDebuggerContext.getThreadProxy();
      try {
        if (!getSuspendContext().getDebugProcess().getSuspendManager().isSuspended(thread)) {
          DebuggerInvocationUtil.swingInvokeLater(
              getProject(),
              new Runnable() {
                public void run() {
                  try {
                    myFramesListener.setEnabled(false);
                    synchronized (myFramesList) {
                      final DefaultListModel model = myFramesList.getModel();
                      model.clear();
                      model.addElement(
                          new Object() {
                            public String toString() {
                              return DebuggerBundle.message("frame.panel.frames.not.available");
                            }
                          });
                      myFramesList.setSelectedIndex(0);
                    }
                  } finally {
                    myFramesListener.setEnabled(true);
                  }
                }
              });

          return;
        }
      } catch (ObjectCollectedException e) {
        return;
      }

      List<StackFrameProxyImpl> frames;
      try {
        frames = thread.frames();
      } catch (EvaluateException e) {
        frames = Collections.emptyList();
      }

      final StackFrameProxyImpl contextFrame = myDebuggerContext.getFrameProxy();
      final EvaluationContextImpl evaluationContext = myDebuggerContext.createEvaluationContext();
      final DebuggerManagerThreadImpl managerThread =
          myDebuggerContext.getDebugProcess().getManagerThread();
      final MethodsTracker tracker = new MethodsTracker();
      final int totalFramesCount = frames.size();
      int index = 0;
      final long timestamp = System.nanoTime();
      for (StackFrameProxyImpl stackFrameProxy : frames) {
        managerThread.schedule(
            new AppendFrameCommand(
                getSuspendContext(),
                stackFrameProxy,
                evaluationContext,
                tracker,
                index++,
                stackFrameProxy.equals(contextFrame),
                totalFramesCount,
                timestamp));
      }
    }