Java 类com.intellij.util.FilteringProcessor 实例源码

项目:intellij-ce-playground    文件:EditorHyperlinkSupport.java   
public static List<RangeHighlighter> getHyperlinks(int startOffset, int endOffset, final Editor editor) {
  final MarkupModelEx markupModel = (MarkupModelEx)editor.getMarkupModel();
  final CommonProcessors.CollectProcessor<RangeHighlighterEx> processor = new CommonProcessors.CollectProcessor<RangeHighlighterEx>();
  markupModel.processRangeHighlightersOverlappingWith(startOffset, endOffset,
                                                      new FilteringProcessor<RangeHighlighterEx>(new Condition<RangeHighlighterEx>() {
                                                        @Override
                                                        public boolean value(RangeHighlighterEx rangeHighlighterEx) {
                                                          return rangeHighlighterEx.getEditorFilter().avaliableIn(editor) &&
                                                                 HYPERLINK_LAYER == rangeHighlighterEx.getLayer() &&
                                                                 rangeHighlighterEx.isValid() &&
                                                                 getHyperlinkInfo(rangeHighlighterEx) != null;
                                                        }
                                                      }, processor)
  );
  return new ArrayList<RangeHighlighter>(processor.getResults());
}
项目:epigraph    文件:SchemaIndexUtil.java   
public static @NotNull List<SchemaNamespaceDecl> findNamespaces(
    @NotNull Project project,
    @Nullable String namePrefix,
    @NotNull GlobalSearchScope searchScope) {

  // TODO cache all namespaces (if prefix is null)

  SchemaNamespaceByNameIndex index =
      SchemaNamespaceByNameIndex.EP_NAME.findExtension(SchemaNamespaceByNameIndex.class);

  List<String> namespaceFqns = new SmartList<>();
  index.processAllKeys(
      project,
      new FilteringProcessor<>(
          ns -> namePrefix == null || ns.startsWith(namePrefix),
          Processors.cancelableCollectProcessor(namespaceFqns)
      )
  );

  return namespaceFqns.stream()
      .flatMap(ns -> index.get(ns, project, searchScope).stream())
      .collect(Collectors.toList());
}
项目:holdr    文件:HoldrLayoutIndex.java   
public static FilteringProcessor<File> filterLayoutByName(final String layoutName, Processor<File> processor) {
    return new FilteringProcessor<File>(new Condition<File>() {
        @Override
        public boolean value(File file) {
            return layoutName.equals(FileUtil.getNameWithoutExtension(file));
        }
    }, processor);
}
项目:consulo    文件:EditorHyperlinkSupport.java   
public static List<RangeHighlighter> getHyperlinks(int startOffset, int endOffset, final Editor editor) {
  final MarkupModelEx markupModel = (MarkupModelEx)editor.getMarkupModel();
  final CommonProcessors.CollectProcessor<RangeHighlighterEx> processor = new CommonProcessors.CollectProcessor<>();
  markupModel.processRangeHighlightersOverlappingWith(startOffset, endOffset,
                                                      new FilteringProcessor<>(
                                                              rangeHighlighterEx -> HYPERLINK_LAYER == rangeHighlighterEx.getLayer() &&
                                                                                    rangeHighlighterEx.isValid() &&
                                                                                    getHyperlinkInfo(rangeHighlighterEx) != null, processor)
  );
  return new ArrayList<>(processor.getResults());
}
项目:consulo    文件:EditorFilteringMarkupModelEx.java   
@Override
public boolean processRangeHighlightersOverlappingWith(int start, int end, @Nonnull Processor<? super RangeHighlighterEx> processor) {
  //noinspection unchecked
  FilteringProcessor<? super RangeHighlighterEx> filteringProcessor = new FilteringProcessor(IS_AVAILABLE, processor);
  return myDelegate.processRangeHighlightersOverlappingWith(start, end, filteringProcessor);
}
项目:consulo    文件:EditorFilteringMarkupModelEx.java   
@Override
public boolean processRangeHighlightersOutside(int start, int end, @Nonnull Processor<? super RangeHighlighterEx> processor) {
  //noinspection unchecked
  FilteringProcessor<? super RangeHighlighterEx> filteringProcessor = new FilteringProcessor(IS_AVAILABLE, processor);
  return myDelegate.processRangeHighlightersOutside(start, end, filteringProcessor);
}