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()); }
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()); }
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); }
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()); }
@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); }
@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); }