Exemple #1
0
 public void doUpdate(@NotNull AnActionEvent event, final Map<String, Object> _params) {
   try {
     {
       AbstractDebugSession debugSession = DebugActionsUtil.getDebugSession(event);
       event.getPresentation().setEnabled(debugSession != null && debugSession.isStepEnabled());
     }
   } catch (Throwable t) {
     if (log.isErrorEnabled()) {
       log.error("User's action doUpdate method failed. Action:" + "StepOut", t);
     }
     this.disable(event.getPresentation());
   }
 }
  public void doExecute(@NotNull final AnActionEvent event, final Map<String, Object> _params) {
    try {
      AbstractDebugSession debugSession = DebugActionsUtil.getDebugSession(event);
      AbstractUiState uiState = ((AbstractUiState) debugSession.getUiState());
      StringBuffer sb = new StringBuffer();
      for (IThread thread : ListSequence.fromList(uiState.getThreads())) {
        sb.append(thread.getPresentation());
        sb.append('\n');
        for (IStackFrame frame : ListSequence.fromList(thread.getFrames())) {
          ILocation location = frame.getLocation();
          sb.append('\t');
          sb.append("at ");
          sb.append(location.getUnitName());
          sb.append(".");
          sb.append(location.getRoutineName());
          sb.append("(");
          sb.append(frame.getLocation().getFileName());
          sb.append(":");
          sb.append(location.getLineNumber());
          sb.append(")");
          sb.append('\n');
        }
        sb.append('\n');
      }

      final ExportThreadsDialog dialog =
          new ExportThreadsDialog(
              ((IOperationContext) MapSequence.fromMap(_params).get("context")), sb);

      ApplicationManager.getApplication()
          .invokeLater(
              new Runnable() {
                public void run() {
                  dialog.showDialog();
                }
              },
              ModalityState.NON_MODAL);
    } catch (Throwable t) {
      if (log.isErrorEnabled()) {
        log.error("User's action execute method failed. Action:" + "ExportThreads", t);
      }
    }
  }