当前位置: 首页>>代码示例>>Java>>正文


Java ProcessOutputTypes.STDOUT属性代码示例

本文整理汇总了Java中com.intellij.execution.process.ProcessOutputTypes.STDOUT属性的典型用法代码示例。如果您正苦于以下问题:Java ProcessOutputTypes.STDOUT属性的具体用法?Java ProcessOutputTypes.STDOUT怎么用?Java ProcessOutputTypes.STDOUT使用的例子?那么, 这里精选的属性代码示例或许可以为您提供帮助。您也可以进一步了解该属性所在com.intellij.execution.process.ProcessOutputTypes的用法示例。


在下文中一共展示了ProcessOutputTypes.STDOUT属性的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUp

@Override
protected void setUp() throws Exception {
  super.setUp();

  mySplitter = new OutputLineSplitter(false) {
    @Override
    protected void onLineAvailable(@NotNull String text, @NotNull Key outputType, boolean tcLikeFakeOutput) {
      if (ProcessOutputTypes.STDERR != outputType && ProcessOutputTypes.SYSTEM != outputType) outputType = ProcessOutputTypes.STDOUT;
      synchronized (myOutput) {
        List<String> list = myOutput.get(outputType);
        if (list == null) {
          myOutput.put(outputType, list = new ArrayList<String>());
        }
        list.add(text);
      }
    }
  };
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:OutputLineSplitterTest.java

示例2: getProcessOutputType

private static Key getProcessOutputType(@NotNull Log.LogLevel level) {
  switch (level) {
    case VERBOSE:
      return AndroidLogcatConstants.VERBOSE;
    case INFO:
      return AndroidLogcatConstants.INFO;
    case DEBUG:
      return AndroidLogcatConstants.DEBUG;
    case WARN:
      return AndroidLogcatConstants.WARNING;
    case ERROR:
      return AndroidLogcatConstants.ERROR;
    case ASSERT:
      return AndroidLogcatConstants.ASSERT;
  }
  return ProcessOutputTypes.STDOUT;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:AndroidLogFilterModel.java

示例3: notifyTextAvailable

@Override
public void notifyTextAvailable(String text, Key outputType) {
  super.notifyTextAvailable(text, outputType);
  
  if (StringUtil.isEmptyOrSpaces(text)) {
    return;
  }
  String[] lines = text.split("[\\n\\r]+");
  for (String line : lines) {
    String l = line.toLowerCase();
    if (outputType == ProcessOutputTypes.STDOUT) {
      myInfoMessages.add(line);
    }
    else if (outputType == ProcessOutputTypes.STDERR) {
      if (l.contains(IGNORING) || l.contains(SKIPPING) || l.contains(DEBUGGABLE_ERROR)) {
        myInfoMessages.add(line);
      }
      else {
        myErrorMessages.add(line);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:23,代码来源:AndroidOSProcessHandler.java

示例4: notifyLine

/**
 * Notify single line
 *
 * @param line       a line to notify
 * @param outputType output type
 */
private void notifyLine(final String line, final Key outputType) {
  String trimmed = LineHandlerHelper.trimLineSeparator(line);
  // if line ends with return, then it is a progress line, ignore it
  if (myVcs != null && !"\r".equals(line.substring(trimmed.length()))) {
    if (outputType == ProcessOutputTypes.STDOUT) {
      if (!isStdoutSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
        myVcs.showMessages(trimmed);
        LOG.info(line.trim());
      }
      else {
        OUTPUT_LOG.debug(line.trim());
      }
    }
    else if (outputType == ProcessOutputTypes.STDERR && !isStderrSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
      myVcs.showErrorMessages(trimmed);
      LOG.info(line.trim());
    }
    else {
      LOG.debug(line.trim());
    }
  }
  myLineListeners.getMulticaster().onLineAvailable(trimmed, outputType);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:29,代码来源:GitLineHandler.java

示例5: notifyLine

/**
 * Notify single line
 *
 * @param line       a line to notify
 * @param outputType output type
 */
private void notifyLine(final String line, final Key outputType) {
  String trimmed = LineHandlerHelper.trimLineSeparator(line);
  // if line ends with return, then it is a progress line, ignore it
  if (myVcs != null && !"\r".equals(line.substring(trimmed.length()))) {
    if (outputType == ProcessOutputTypes.STDOUT && !isStdoutSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
      myVcs.showMessages(trimmed);
      LOG.info(line.trim());
    }
    else if (outputType == ProcessOutputTypes.STDERR && !isStderrSuppressed() && !mySilent && !StringUtil.isEmptyOrSpaces(line)) {
      myVcs.showErrorMessages(trimmed);
      LOG.info(line.trim());
    }
    else {
      LOG.debug(line.trim());
    }
  }
  myLineListeners.getMulticaster().onLineAvailable(trimmed, outputType);
}
 
开发者ID:lshain-android-source,项目名称:tools-idea,代码行数:24,代码来源:GitLineHandler.java

示例6: notifyLines

@Override
protected void notifyLines(Key outputType, Iterable<String> lines) {
  super.notifyLines(outputType, lines);
  if (outputType == ProcessOutputTypes.STDOUT) {
    List<String> targetList = new LinkedList<String>();
    for (String outputLine : lines) {
      if (!outputLine.isEmpty()) {
        JsonElement jsonElement = new JsonParser().parse(outputLine);
        if (jsonElement.isJsonArray()) {
          JsonArray targets = jsonElement.getAsJsonArray();

          for (JsonElement target : targets) {
            targetList.add(target.getAsString());
          }
        }
      }
    }
    actionsToExecute.apply(targetList);
  }
}
 
开发者ID:facebook,项目名称:buck,代码行数:20,代码来源:BuckQueryCommandHandler.java

示例7: setUp

@Override
protected void setUp() throws Exception {
  super.setUp();

  mySplitter = new OutputLineSplitter(false) {
    @Override
    protected void onLineAvailable(@Nonnull String text, @Nonnull Key outputType, boolean tcLikeFakeOutput) {
      if (ProcessOutputTypes.STDERR != outputType && ProcessOutputTypes.SYSTEM != outputType) outputType = ProcessOutputTypes.STDOUT;
      synchronized (myOutput) {
        List<String> list = myOutput.get(outputType);
        if (list == null) {
          myOutput.put(outputType, list = new ArrayList<String>());
        }
        list.add(text);
      }
    }
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:18,代码来源:OutputLineSplitterTest.java

示例8: processLine

@NotNull
@Override
public MyProcessingResult processLine(String line) {
    LogCatMessage message = null;
    String continuation = null;
    boolean validContinuation = false;
    try {
        message = AndroidLogcatFormatter.tryParseMessage(line);
        continuation = message == null ? AndroidLogcatFormatter.tryParseContinuation(line) : null;
        validContinuation = continuation != null && this.myPrevHeader != null;
    } catch (Exception ignored) {
    }

    if (message == null && !validContinuation) {
        return new MyProcessingResult(ProcessOutputTypes.STDOUT, canAcceptMessage(line), null);
    } else {
        if (message != null) {
            this.myPrevHeader = message.getHeader();
            this.myCustomApplicable = this.isMessageApplicable(message);
            this.myMessageSoFar.setLength(0);
        }

        boolean isApplicable = this.myCustomApplicable;
        if (!isApplicable) {
            this.myMessageSoFar.append(line);
            this.myMessageSoFar.append('\n');
        }

        Key key = AndroidLogcatUtils.getProcessOutputType(this.myPrevHeader.getLogLevel());
        MyProcessingResult result = new MyProcessingResult(key, isApplicable, this.myMessageSoFar.toString());
        if (isApplicable) {
            this.myMessageSoFar.setLength(0);
        }

        return result;
    }
}
 
开发者ID:josesamuel,项目名称:logviewer,代码行数:37,代码来源:LogView.java

示例9: processLine

@Override
@NotNull
public MyProcessingResult processLine(String line) {
  final String type = LogConsolePreferences.getType(line);
  Key contentType = type != null
                    ? LogConsolePreferences.getProcessOutputTypes(type)
                    : (LogConsolePreferences.ERROR.equals(myPrevType) ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT);
  if (type != null) {
    myPrevType = type;
  }
  final boolean applicable = isApplicable(line);
  return new MyProcessingResult(contentType, applicable, null);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:DefaultLogFilterModel.java

示例10: onTextAvailable

protected void onTextAvailable(final String text, final Key outputType) {
  Iterator<String> lines = LineHandlerHelper.splitText(text).iterator();
  if (ProcessOutputTypes.STDOUT == outputType) {
    notifyLines(outputType, lines, myStdoutLine);
  }
  else if (ProcessOutputTypes.STDERR == outputType) {
    notifyLines(outputType, lines, myStderrLine);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:GitLineHandler.java

示例11: execute

@NotNull
public HgCommandResult execute(final boolean showTextOnIndicator, boolean isBinary) throws ShellCommandException, InterruptedException {
  final ProgressIndicator indicator = ProgressManager.getInstance().getProgressIndicator();
  try {
    HgCommandProcessHandler processHandler = new HgCommandProcessHandler(myCommandLine, isBinary);
    CapturingProcessAdapter outputAdapter = new CapturingProcessAdapter() {

      @Override
      public void onTextAvailable(ProcessEvent event, Key outputType) {
        Iterator<String> lines = LineHandlerHelper.splitText(event.getText()).iterator();
        if (ProcessOutputTypes.STDOUT == outputType) {
          while (lines.hasNext()) {
            String line = lines.next();
            if (indicator != null && showTextOnIndicator) {
              indicator.setText2(line);
            }
            addToOutput(line, ProcessOutputTypes.STDOUT);
          }
        }
        else {
          super.onTextAvailable(event, outputType);
        }
      }
    };
    processHandler.addProcessListener(outputAdapter);
    processHandler.startNotify();
    while (!processHandler.waitFor(300)) {
      if (indicator != null && indicator.isCanceled()) {
        processHandler.destroyProcess();
        outputAdapter.getOutput().setExitCode(255);
        break;
      }
    }
    ProcessOutput output = outputAdapter.getOutput();
    return new HgCommandResult(output, processHandler.getBinaryOutput());
  }
  catch (ExecutionException e) {
    throw new ShellCommandException(e);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:40,代码来源:ShellCommand.java

示例12: execute

private String execute(@NotNull List<String> parameters, @NotNull File path) throws SvnBindException {
  // workaround: separately capture command output - used in exception handling logic to overcome svn 1.8 issue (see below)
  final ProcessOutput output = new ProcessOutput();
  LineCommandListener listener = new LineCommandAdapter() {
    @Override
    public void onLineAvailable(String line, Key outputType) {
      if (outputType == ProcessOutputTypes.STDOUT) {
        output.appendStdout(line);
      }
    }
  };

  try {
    CommandExecutor command = execute(myVcs, SvnTarget.fromFile(path), SvnCommandName.info, parameters, listener);

    return command.getOutput();
  }
  catch (SvnBindException e) {
    final String text = StringUtil.notNullize(e.getMessage());
    if (text.contains("W155010")) {
      // if "svn info" is executed for several files at once, then this warning could be printed only for some files, but info for other
      // files should be parsed from output
      return output.getStdout();
    }
    // not a working copy exception
    // "E155007: '' is not a working copy"
    if (text.contains("is not a working copy") && StringUtil.isNotEmpty(output.getStdout())) {
      // TODO: Seems not reproducible in 1.8.4
      // workaround: as in subversion 1.8 "svn info" on a working copy root outputs such error for parent folder,
      // if there are files with conflicts.
      // but the requested info is still in the output except root closing tag
      return output.getStdout() + "</info>";
    }
    throw e;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:36,代码来源:CmdInfoClient.java

示例13: resolveOutputType

@NotNull
protected Key resolveOutputType(@NotNull String line, @NotNull Key outputType) {
  Key result = outputType;

  if (!ProcessOutputTypes.SYSTEM.equals(outputType)) {
    Matcher errorMatcher = SvnUtil.ERROR_PATTERN.matcher(line);
    Matcher warningMatcher = SvnUtil.WARNING_PATTERN.matcher(line);

    result = errorMatcher.find() || warningMatcher.find() ? ProcessOutputTypes.STDERR : ProcessOutputTypes.STDOUT;
  }

  return result;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:TerminalProcessHandler.java

示例14: onTextAvailable

private void onTextAvailable(final String text, final Key outputType) {
  Iterator<String> lines = LineHandlerHelper.splitText(text).iterator();
  if (ProcessOutputTypes.STDOUT == outputType) {
    notifyLines(outputType, lines, myStdoutLine);
  }
  else if (ProcessOutputTypes.STDERR == outputType) {
    notifyLines(outputType, lines, myStderrLine);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:ResultBuilderNotifier.java

示例15: notifyTextAvailable

@Override
public void notifyTextAvailable(String text, Key outputType) {
  text = StringUtil.convertLineSeparators(text);
  if (LOG.isDebugEnabled()) {
    LOG.debug(outputType + text);
  }
  if (outputType == ProcessOutputTypes.STDOUT) {
    myStdOut.append(text);
  }
  else if (outputType == ProcessOutputTypes.STDERR) {
    myStdErr.append(text);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:13,代码来源:GrabDependencies.java


注:本文中的com.intellij.execution.process.ProcessOutputTypes.STDOUT属性示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。