Ejemplo n.º 1
0
  @Override
  public void eventReceived(Object output) {
    if (fSuppressConsoleOutputCounter > 0) return;
    for (MIOOBRecord oobr : ((MIOutput) output).getMIOOBRecords()) {
      if (oobr instanceof MIConsoleStreamOutput) {
        MIConsoleStreamOutput out = (MIConsoleStreamOutput) oobr;
        String str = out.getString();

        if (str.trim().equals(SECONDARY_PROMPT)) {
          // Make sure to skip any secondary prompt that we
          // have already printed ourselves.  This would happen
          // when a new version of the backend starts sending
          // the secondary prompt for a command that it didn't
          // use to.  In this case, we still send it ourselves.
          if (inMissingSecondaryPrompt()) {
            return;
          }
          // Add a space for readability
          str = SECONDARY_PROMPT + ' ';
        }

        setPrompt(str);
        try {
          if (fMIOutConsolePipe != null) {
            fMIOutConsolePipe.write(str.getBytes());
            fMIOutConsolePipe.flush();
          }
        } catch (IOException e) {
        }
      } else if (oobr instanceof MILogStreamOutput) {
        MILogStreamOutput out = (MILogStreamOutput) oobr;
        String str = out.getString();
        if (str != null) {
          try {
            if (fMIOutLogPipe != null) {
              fMIOutLogPipe.write(str.getBytes());
              fMIOutLogPipe.flush();
            }
          } catch (IOException e) {
          }
        }
      }
    }
  }