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


Java Filter类代码示例

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


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

示例1: printLine

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
private void printLine(@NotNull String line, @NotNull ConsoleViewContentType contentType) {
  Filter.Result result = null;
  try {
    result = myFilter.applyFilter(line, line.length());
  }
  catch (Throwable t) {
    throw new RuntimeException("Error while applying " + myFilter + " to '"+line+"'", t);
  }
  if (result != null) {
    defaultPrint(line.substring(0, result.getHighlightStartOffset()), contentType);
    String linkText = line.substring(result.getHighlightStartOffset(), result.getHighlightEndOffset());
    printHyperlink(linkText, result.getHyperlinkInfo());
    defaultPrint(line.substring(result.getHighlightEndOffset()), contentType);
  }
  else {
    defaultPrint(line, contentType);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:19,代码来源:TestProxyPrinterProvider.java

示例2: passLine

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
private List<String> passLine(String line) {
  if (!line.endsWith("\n")) {
    line += '\n';
  }

  Filter.Result result = myFilter.applyFilter(line, line.length());
  if (result == null) return Collections.emptyList();

  List<String> res = new ArrayList<String>();

  for (Filter.ResultItem item : result.getResultItems()) {
    res.add(line.substring(item.highlightStartOffset, item.highlightEndOffset));
  }

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

示例3: highlightHyperlinks

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
void highlightHyperlinks(@Nonnull Filter.Result result, int offsetDelta) {
  Document document = myEditor.getDocument();
  for (Filter.ResultItem resultItem : result.getResultItems()) {
    int start = resultItem.getHighlightStartOffset() + offsetDelta;
    int end = resultItem.getHighlightEndOffset() + offsetDelta;
    if (start < 0 || end < start || end > document.getTextLength()) {
      continue;
    }

    TextAttributes attributes = resultItem.getHighlightAttributes();
    if (resultItem.getHyperlinkInfo() != null) {
      createHyperlink(start, end, attributes, resultItem.getHyperlinkInfo(), resultItem.getFollowedHyperlinkAttributes());
    }
    else if (attributes != null) {
      addHighlighter(start, end, attributes);
    }
  }
}
 
开发者ID:consulo,项目名称:consulo,代码行数:19,代码来源:EditorHyperlinkSupport.java

示例4: highlightHyperlinksAsync

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
@Nonnull
private Computable<FilterResults> highlightHyperlinksAsync(Filter filter, int startLine, int endLine) {
  Document document = myEditor.getDocument();
  int markerOffset = document.getLineEndOffset(endLine);
  RangeMarker marker = document.createRangeMarker(markerOffset, markerOffset);
  List<LineHighlighter> tasks = new ArrayList<>();
  for (int i = startLine; i <= endLine; i++) {
     tasks.add(processLine(document, filter, i));
  }
  return () -> {
    List<Filter.Result> results = new ArrayList<>();
    for (LineHighlighter task : tasks) {
      ProgressManager.checkCanceled();
      if (!marker.isValid()) return FilterResults.EMPTY;
      ContainerUtil.addIfNotNull(results, task.compute());
    }
    return new FilterResults(markerOffset, marker, results);
  };
}
 
开发者ID:consulo,项目名称:consulo,代码行数:20,代码来源:AsyncFilterRunner.java

示例5: getConsole

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public ConsoleView getConsole() {
    final ConsoleView consoleView = createConsole();
    for (final Filter filter : myFilters) {
        consoleView.addMessageFilter(filter);
    }

    return consoleView;
}
 
开发者ID:internetisalie,项目名称:lua-for-idea,代码行数:9,代码来源:LuaTextConsoleBuilder.java

示例6: getConsoleMessageFilters

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
private Filter[] getConsoleMessageFilters(@NotNull Project project, @NotNull PhpPathMapper pathMapper) {
    return new Filter[]{
            new PhpErrorMessageFilter(project, pathMapper),
            new PhpUnitFilter(project, pathMapper),
            new XdebugCallStackFilter(project, pathMapper),
            new DrupalRunTestMessageFilter(project, pathMapper)
    };
}
 
开发者ID:mglaman,项目名称:intellij-drupal-run-tests,代码行数:9,代码来源:DrupalRunConfiguration.java

示例7: executeRun

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public static boolean executeRun(@NotNull final Project project, String contentName, Icon icon, DataContext dataContext, Filter[] filters) throws ExecutionException {
  final JavaParameters cmdLine = JavaParameters.JAVA_PARAMETERS.getData(dataContext);
  final DefaultRunProfile profile = new DefaultRunProfile(project, cmdLine, contentName, icon, filters);
  ExecutionEnvironmentBuilder builder = ExecutionEnvironmentBuilder.createOrNull(project, DefaultRunExecutor.getRunExecutorInstance(), profile);
  if (builder != null) {
    builder.buildAndExecute();
    return true;
  }
  return false;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:11,代码来源:JavaExecutionUtil.java

示例8: DefaultRunProfile

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public DefaultRunProfile(final Project project, final JavaParameters parameters, final String contentName, final Icon icon, Filter[] filters) {
  myProject = project;
  myParameters = parameters;
  myContentName = contentName;
  myFilters = filters;
  myIcon = icon;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:JavaExecutionUtil.java

示例9: getPrinterByType

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
@Nullable
public Printer getPrinterByType(@NotNull String nodeType, @NotNull String nodeName, @Nullable String nodeArguments) {
  Filter filter = myFilterProvider.getFilter(nodeType, nodeName, nodeArguments);
  if (filter != null) {
    return new HyperlinkPrinter(myTestOutputConsoleView, HyperlinkPrinter.ERROR_CONTENT_TYPE, filter);
  }
  return null;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:9,代码来源:TestProxyPrinterProvider.java

示例10: HyperlinkPrinter

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public HyperlinkPrinter(@NotNull BaseTestsOutputConsoleView testsOutputConsoleView,
                        @NotNull Condition<ConsoleViewContentType> contentTypeCondition,
                        @NotNull Filter filter) {
  super(testsOutputConsoleView, testsOutputConsoleView.getProperties(), null);
  myContentTypeCondition = contentTypeCondition;
  myFilter = filter;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:TestProxyPrinterProvider.java

示例11: highlightHyperlinks

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
@Deprecated
public void highlightHyperlinks(final Filter customFilter, final Filter predefinedMessageFilter, final int line1, final int endLine) {
  highlightHyperlinks(new Filter() {
    @Nullable
    @Override
    public Result applyFilter(String line, int entireLength) {
      Result result = customFilter.applyFilter(line, entireLength);
      return result != null ? result : predefinedMessageFilter.applyFilter(line, entireLength);
    }
  }, line1, endLine);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:12,代码来源:EditorHyperlinkSupport.java

示例12: processNode

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
private void processNode(AbstractTestProxy node, final Filter filter) throws SAXException {
  ProgressManager.checkCanceled();
  Map<String, String> attrs = new HashMap<String, String>();
  attrs.put(ATTR_NAME, node.getName());
  attrs.put(ATTR_STATUS, getStatusString(node));
  Long duration = node.getDuration();
  if (duration != null) {
    attrs.put(ATTR_DURATION, String.valueOf(duration));
  }
  String locationUrl = node.getLocationUrl();
  if (locationUrl != null) {
    attrs.put(ATTR_LOCATION, locationUrl);
  }
  if (node.isConfig()) {
    attrs.put(ATTR_CONFIG, "true");
  }
  boolean started = false;
  String elemName = node.isLeaf() ? ELEM_TEST : ELEM_SUITE;
  if (node.isLeaf()) {
    started = true;
    startElement(elemName, attrs);
    writeOutput(node, filter);
  }
  else {
    for (AbstractTestProxy child : node.getChildren()) {
      if (myHidePassedConfig && child.isConfig() && child.isPassed()) {
        //ignore configurations during export
        continue;
      }
      if (!started) {
        started = true;
        startElement(elemName, attrs);
      }
      processNode(child, filter);
    }
  }
  if (started) {
    endElement(elemName);
  }
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:41,代码来源:TestResultsXmlFormatter.java

示例13: writeOutput

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
private void writeOutput(ConsoleViewContentType type, StringBuilder text, Filter filter) throws SAXException {
  StringBuilder output = new StringBuilder();
  StringTokenizer t = new StringTokenizer(text.toString(), "\n");
  while (t.hasMoreTokens()) {
    String line = StringUtil.escapeXml(t.nextToken()) + "\n";
    Filter.Result result = null;//filter.applyFilter(line, line.length());
    if (result != null && result.hyperlinkInfo instanceof OpenFileHyperlinkInfo) {
      output.append(line.substring(0, result.highlightStartOffset));
      OpenFileDescriptor descriptor = ((OpenFileHyperlinkInfo)result.hyperlinkInfo).getDescriptor();
      output.append("<a href=\"javascript://\" onclick=\"Activator.doOpen('file?file=");
      output.append(descriptor.getFile().getPresentableUrl());
      output.append("&line=");
      output.append(descriptor.getLine());
      output.append("')\">");
      output.append(line.substring(result.highlightStartOffset, result.highlightEndOffset));
      output.append("</a>");
      output.append(line.substring(result.highlightEndOffset));
    }
    else {
      output.append(line);
    }
  }

  Map<String, String> a = new HashMap<String, String>();
  a.put(ATTR_OUTPUT_TYPE, getTypeString(type));
  startElement(ELEM_OUTPUT, a);
  writeText(output.toString());
  text.delete(0, text.length());
  endElement(ELEM_OUTPUT);
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:31,代码来源:TestResultsXmlFormatter.java

示例14: getConsole

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public ConsoleView getConsole() {
  final ConsoleView consoleView = createConsole();
  for (final Filter filter : myFilters) {
    consoleView.addMessageFilter(filter);
  }
  return consoleView;
}
 
开发者ID:jskierbi,项目名称:intellij-ce-playground,代码行数:8,代码来源:PyDebugConsoleBuilder.java

示例15: BlazeCommandRunProfileState

import com.intellij.execution.filters.Filter; //导入依赖的package包/类
public BlazeCommandRunProfileState(
    ExecutionEnvironment environment, Collection<Filter> consoleFilters) {
  super(environment);
  this.configuration = getConfiguration(environment);
  this.handlerState =
      (BlazeCommandRunConfigurationCommonState) configuration.getHandler().getState();
  this.consoleFilters =
      ImmutableList.<Filter>builder()
          .addAll(consoleFilters)
          .add(new BlazeTargetFilter(environment.getProject(), true))
          .add(new UrlFilter())
          .build();
}
 
开发者ID:bazelbuild,项目名称:intellij,代码行数:14,代码来源:BlazeCommandGenericRunConfigurationRunner.java


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