Java Code Examples for com.intellij.execution.ui.ConsoleViewContentType#NORMAL_OUTPUT

The following examples show how to use com.intellij.execution.ui.ConsoleViewContentType#NORMAL_OUTPUT . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void print(@NotNull String text, @NotNull ConsoleViewContentType contentType) {
  if (FlutterSettings.getInstance().isVerboseLogging()) {
    super.print(text, contentType);
    return;
  }

  if (contentType != ConsoleViewContentType.NORMAL_OUTPUT) {
    writeAvailableLines();

    super.print(text, contentType);
  }
  else {
    stdoutParser.appendOutput(text);
    writeAvailableLines();
  }
}
 
Example 2
Source File: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void writeAvailableLines() {
  for (String line : stdoutParser.getAvailableLines()) {
    if (DaemonApi.parseAndValidateDaemonEvent(line.trim()) != null) {
      if (FlutterSettings.getInstance().isVerboseLogging()) {
        LOG.info(line.trim());
      }
    }
    else {
      // We're seeing a spurious newline before some launches; this removes any single newline that occurred
      // before we've printed text.
      if (!hasPrintedText && line.equals(("\n"))) {
        continue;
      }

      hasPrintedText = true;

      super.print(line, ConsoleViewContentType.NORMAL_OUTPUT);
    }
  }
}
 
Example 3
Source File: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Override
public void print(@NotNull String text, @NotNull ConsoleViewContentType contentType) {
  if (FlutterSettings.getInstance().isVerboseLogging()) {
    super.print(text, contentType);
    return;
  }

  if (contentType != ConsoleViewContentType.NORMAL_OUTPUT) {
    writeAvailableLines();

    super.print(text, contentType);
  }
  else {
    stdoutParser.appendOutput(text);
    writeAvailableLines();
  }
}
 
Example 4
Source File: DaemonConsoleView.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void writeAvailableLines() {
  for (String line : stdoutParser.getAvailableLines()) {
    if (DaemonApi.parseAndValidateDaemonEvent(line.trim()) != null) {
      if (FlutterSettings.getInstance().isVerboseLogging()) {
        LOG.info(line.trim());
      }
    }
    else {
      // We're seeing a spurious newline before some launches; this removes any single newline that occurred
      // before we've printed text.
      if (!hasPrintedText && line.equals(("\n"))) {
        continue;
      }

      hasPrintedText = true;

      super.print(line, ConsoleViewContentType.NORMAL_OUTPUT);
    }
  }
}
 
Example 5
Source File: FlutterLogEntryParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FlutterLogEntry parseConsoleEvent(String text, ConsoleViewContentType type) {
  if (type == ConsoleViewContentType.NORMAL_OUTPUT) {
    return parseDaemonEvent(text);
  }
  // TODO(pq): handle else (errors, etc).
  return null;
}
 
Example 6
Source File: FlutterLogEntryParser.java    From flutter-intellij with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public FlutterLogEntry parseConsoleEvent(String text, ConsoleViewContentType type) {
  if (type == ConsoleViewContentType.NORMAL_OUTPUT) {
    return parseDaemonEvent(text);
  }
  // TODO(pq): handle else (errors, etc).
  return null;
}
 
Example 7
Source File: MockPrinter.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Override
public void print(String s, ConsoleViewContentType contentType) {
  myHasPrinted = true;
  myAllOut.append(s);
  if (contentType == ConsoleViewContentType.NORMAL_OUTPUT) {
    myStdOut.append(s);
  }
  else if (contentType == ConsoleViewContentType.ERROR_OUTPUT) {
    myStdErr.append(s);
  }
  else if (contentType == ConsoleViewContentType.SYSTEM_OUTPUT) {
    myStdSys.append(s);
  }
}
 
Example 8
Source File: ConsoleViewUtil.java    From consulo with Apache License 2.0 5 votes vote down vote up
@Nonnull
public static ConsoleViewContentType getContentTypeForToken(@Nonnull IElementType tokenType, @Nonnull SyntaxHighlighter highlighter) {
  TextAttributesKey[] keys = highlighter.getTokenHighlights(tokenType);
  if (keys.length == 0) {
    return ConsoleViewContentType.NORMAL_OUTPUT;
  }
  return ConsoleViewContentType.getConsoleViewType(ColorCache.keys.get(Arrays.asList(keys)));
}
 
Example 9
Source File: CppDebugRunner.java    From CppTools with Apache License 2.0 5 votes vote down vote up
@Override
public String getRunCommandText(CppRunConfiguration configuration, CppDebugProcess<CppRunConfiguration> cppDebugProcess) {
  String runCommand = "run";

  if (!CppDebuggerConstants.gdbCanNotRedirectOutputOfDebuggedCommand) {
    File outFile;
    File errFile;

    try {
      // TODO: output redirecting from parameters!
      outFile = File.createTempFile("out", "");
      errFile = File.createTempFile("err", "");

      ReadFileTask task = new ReadFileTask(outFile, ConsoleViewContentType.NORMAL_OUTPUT, cppDebugProcess);

      ApplicationManager.getApplication().executeOnPooledThread(task);
      ReadFileTask task2 = new ReadFileTask(errFile, ConsoleViewContentType.ERROR_OUTPUT, cppDebugProcess);
      ApplicationManager.getApplication().executeOnPooledThread(task2);

      String executableParameters = configuration.getRunnerParameters().getExecutableParameters();
      if (!CppRunConfiguration.isEmpty(executableParameters)) runCommand += " " + executableParameters;
      
      runCommand += " >" + outFile.getPath() + " 2>" + errFile.getPath();
    } catch (IOException ex) {
      // TODO:
      ex.printStackTrace();
    }
  }

  return runCommand;
}
 
Example 10
Source File: LogConsolePreferences.java    From consulo with Apache License 2.0 4 votes vote down vote up
public static ConsoleViewContentType getContentType(String type) {
  if (type.equals(ERROR)) return ConsoleViewContentType.ERROR_OUTPUT;
  return ConsoleViewContentType.NORMAL_OUTPUT;
}