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


Java ProcessOutputTypes类代码示例

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


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

示例1: run

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@Override
public void run() {

    while (!handler.isProcessTerminated()){
        try {
            BufferedReader reader = new BufferedReader(new FileReader(file));

            if (file.length() >= pointer)
                reader.skip(pointer);

            String line;
            while ((line = reader.readLine()) != null){
                if (line.contains(".ERROR: ") || line.equals("Stack trace:") || line.matches("(#\\d+ .+)"))
                    handler.notifyTextAvailable(line + "\n",ProcessOutputTypes.STDERR);
                else
                    handler.notifyTextAvailable(line + "\n",ProcessOutputTypes.STDOUT);


                pointer = file.length();
            }

            Thread.sleep(500);
        } catch (InterruptedException | IOException ignored){}
    }

}
 
开发者ID:3mmarg97,项目名称:LaravelStorm,代码行数:27,代码来源:LaravelRunMgr.java

示例2: printContextWithText

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
protected void printContextWithText(final StackFrameContext context) {
  ApplicationManager.getApplication().runReadAction(new Runnable() {
    @Override
    public void run() {
      if (context.getFrameProxy() != null) {
        SourcePosition sourcePosition = PositionUtil.getSourcePosition(context);
        int offset = sourcePosition.getOffset();
        Document document = PsiDocumentManager.getInstance(myProject).getDocument(sourcePosition.getFile());
        CharSequence text = document.getImmutableCharSequence();
        String positionText = "";
        if (offset > -1) {
          positionText = StringUtil.escapeLineBreak(" [" + text.subSequence(Math.max(0, offset - 20), offset) + "<*>"
          + text.subSequence(offset, Math.min(offset + 20, text.length())) + "]");
        }

        println(sourcePosition.getFile().getVirtualFile().getName()
                + ":" + sourcePosition.getLine()
                + positionText,
                ProcessOutputTypes.SYSTEM);
      }
      else {
        println("Context thread is null", ProcessOutputTypes.SYSTEM);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:ExecutionWithDebuggerToolsTestCase.java

示例3: onTestOutput

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
public void onTestOutput(@NotNull final TestOutputEvent testOutputEvent) {
   addToInvokeLater(new Runnable() {
    public void run() {
      final String testName = testOutputEvent.getName();
      final String text = testOutputEvent.getText();
      final boolean stdOut = testOutputEvent.isStdOut();
      final String fullTestName = getFullTestName(testName);
      final SMTestProxy testProxy = getProxyByFullTestName(fullTestName);
      if (testProxy == null) {
        logProblem("Test wasn't started! TestOutput event: name = {" + testName + "}, " +
                   "isStdOut = " + stdOut + ", " +
                   "text = {" + text + "}. " +
                   cannotFindFullTestNameMsg(fullTestName));
        return;
      }

      if (stdOut) {
        testProxy.addStdOutput(text, ProcessOutputTypes.STDOUT);
      } else {
        testProxy.addStdErr(text);
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:25,代码来源:GeneralToSMTRunnerEventsConvertor.java

示例4: onTestOutput

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
public void onTestOutput(@NotNull final TestOutputEvent testOutputEvent) {
  addToInvokeLater(new Runnable() {
    public void run() {
      Node node = findNode(testOutputEvent);
      if (node == null) {
        logProblem("Test wasn't started! But " + testOutputEvent + "!");
        return;
      }
      SMTestProxy testProxy = node.getProxy();

      if (testOutputEvent.isStdOut()) {
        testProxy.addStdOutput(testOutputEvent.getText(), ProcessOutputTypes.STDOUT);
      } else {
        testProxy.addStdErr(testOutputEvent.getText());
      }
    }
  });
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:GeneralIdBasedToSMTRunnerEventsConvertor.java

示例5: printError

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
private static void printError(@NotNull final Printer printer,
                              @NotNull final List<String> errorPresentationText,
                              final boolean setMark)
{
  boolean addMark = setMark;
  for (final String errorText : errorPresentationText) {
    if (errorText != null) {
      printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
      if (addMark) {
        printer.mark();
        addMark = false;
      }
      TestsPresentationUtil.printWithAnsiColoring(printer, errorText, ProcessOutputTypes.STDERR);
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TestFailedState.java

示例6: printOn

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@Override
public void printOn(Printer printer) {
  printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
  printer.mark();

  // Error msg
  TestsPresentationUtil.printWithAnsiColoring(printer, myErrorMsgPresentation, ProcessOutputTypes.STDERR);

  // Diff link
  myHyperlink.printOn(printer);

  // Stacktrace
  printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
  TestsPresentationUtil.printWithAnsiColoring(printer, myStacktracePresentation, ProcessOutputTypes.STDERR);
  printer.print(CompositePrintable.NEW_LINE, ConsoleViewContentType.ERROR_OUTPUT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:TestComparisionFailedState.java

示例7: setUp

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@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,代码行数:19,代码来源:OutputLineSplitterTest.java

示例8: testStopCollectingOutput

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
public void testStopCollectingOutput() {
  myResultsViewer.selectAndNotify(myResultsViewer.getTestsRootNode());
  //noinspection NullableProblems
  myConsole.attachToProcess(null);

  myEventsProcessor.onStartTesting();
  myEventsProcessor.onSuiteStarted(new TestSuiteStartedEvent("suite", null));
  final SMTestProxy suite = myEventsProcessor.getCurrentSuite();
  myEventsProcessor.onSuiteFinished(new TestSuiteFinishedEvent("suite"));
  myEventsProcessor.onUncapturedOutput("preved", ProcessOutputTypes.STDOUT);
  myEventsProcessor.onFinishTesting();

  //myResultsViewer.selectAndNotify(suite);
  //the string above doesn't update tree immediately so we should simulate update
  myConsole.getPrinter().updateOnTestSelected(suite);

  //Lets reset printer /clear console/ before selection changed to
  //get after selection event only actual ouptut
  myMockResettablePrinter.resetIfNecessary();

  //myResultsViewer.selectAndNotify(myResultsViewer.getTestsRootNode());
  //the string above doesn't update tree immediately so we should simulate update
  myConsole.getPrinter().updateOnTestSelected(myResultsViewer.getTestsRootNode());

  assertAllOutputs(myMockResettablePrinter, "preved", "","Empty test suite.\n");
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:SMTRunnerConsoleTest.java

示例9: getProcessOutputType

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
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,代码行数:18,代码来源:AndroidLogFilterModel.java

示例10: getCopyOfCompilerManifestFile

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@Nullable
protected static Pair<File, String> getCopyOfCompilerManifestFile(@NotNull AndroidFacet facet, @Nullable ProcessHandler processHandler) {
  final VirtualFile manifestFile = AndroidRootUtil.getCustomManifestFileForCompiler(facet);

  if (manifestFile == null) {
    return null;
  }
  File tmpDir = null;
  try {
    tmpDir = FileUtil.createTempDirectory("android_manifest_file_for_execution", "tmp");
    final File manifestCopy = new File(tmpDir, manifestFile.getName());
    FileUtil.copy(new File(manifestFile.getPath()), manifestCopy);
    //noinspection ConstantConditions
    return Pair.create(manifestCopy, PathUtil.getLocalPath(manifestFile));
  }
  catch (IOException e) {
    if (processHandler != null) {
      processHandler.notifyTextAvailable("I/O error: " + e.getMessage(), ProcessOutputTypes.STDERR);
    }
    LOG.info(e);
    if (tmpDir != null) {
      FileUtil.delete(tmpDir);
    }
    return null;
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidRunConfigurationBase.java

示例11: launch

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@Override
public LaunchResult launch(@NotNull AndroidRunningState state, @NotNull IDevice device)
  throws IOException, AdbCommandRejectedException, TimeoutException {
  state.getProcessHandler().notifyTextAvailable("Running tests\n", ProcessOutputTypes.STDOUT);
  RemoteAndroidTestRunner runner = new RemoteAndroidTestRunner(state.getTestPackageName(), myInstrumentationTestRunner, device);
  switch (TESTING_TYPE) {
    case TEST_ALL_IN_PACKAGE:
      runner.setTestPackageName(PACKAGE_NAME);
      break;
    case TEST_CLASS:
      runner.setClassName(CLASS_NAME);
      break;
    case TEST_METHOD:
      runner.setMethodName(CLASS_NAME, METHOD_NAME);
      break;
  }
  runner.setDebug(state.isDebugMode());
  try {
    runner.run(new AndroidTestListener(state));
  }
  catch (ShellCommandUnresponsiveException e) {
    LOG.info(e);
    state.getProcessHandler().notifyTextAvailable("Error: time out", ProcessOutputTypes.STDERR);
  }
  return LaunchResult.SUCCESS;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:27,代码来源:AndroidTestRunConfiguration.java

示例12: notifyTextAvailable

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@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,代码行数:24,代码来源:AndroidOSProcessHandler.java

示例13: notifyLine

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
/**
 * 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,代码行数:30,代码来源:GitLineHandler.java

示例14: onLineAvailable

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
@Override
public void onLineAvailable(String line, Key outputType) {
  if (ProcessOutputTypes.STDOUT.equals(outputType)) {
    final ProgressEvent event = converter.convert(line);
    if (event != null) {
      beforeHandler(event);
      try {
        callHandler(event);
      }
      catch (SVNException e) {
        cancel();
        exception.set(e);
      }
    }
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:17,代码来源:BaseUpdateCommandListener.java

示例15: notifyTextAvailable

import com.intellij.execution.process.ProcessOutputTypes; //导入依赖的package包/类
public void notifyTextAvailable(final String text, final Key outputType) {
  if (LOG.isDebugEnabled()) {
    LOG.debug("Received from groovyc " + outputType + ": " + text);
  }

  if (outputType == ProcessOutputTypes.SYSTEM) {
    return;
  }

  if (outputType == ProcessOutputTypes.STDERR && !isSafeStderr(text)) {
    stdErr.append(StringUtil.convertLineSeparators(text));
    return;
  }


  parseOutput(text);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:18,代码来源:GroovycOutputParser.java


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