Search in sources :

Example 1 with RangeBlinker

use of com.intellij.util.ui.RangeBlinker in project intellij-community by JetBrains.

the class SearchForUsagesRunnable method flashUsageScriptaculously.

private static void flashUsageScriptaculously(@NotNull final Usage usage) {
    if (!(usage instanceof UsageInfo2UsageAdapter)) {
        return;
    }
    UsageInfo2UsageAdapter usageInfo = (UsageInfo2UsageAdapter) usage;
    Editor editor = usageInfo.openTextEditor(true);
    if (editor == null)
        return;
    TextAttributes attributes = EditorColorsManager.getInstance().getGlobalScheme().getAttributes(CodeInsightColors.BLINKING_HIGHLIGHTS_ATTRIBUTES);
    RangeBlinker rangeBlinker = new RangeBlinker(editor, attributes, 6);
    List<Segment> segments = new ArrayList<>();
    Processor<Segment> processor = Processors.cancelableCollectProcessor(segments);
    usageInfo.processRangeMarkers(processor);
    rangeBlinker.resetMarkers(segments);
    rangeBlinker.startBlinking();
}
Also used : RangeBlinker(com.intellij.util.ui.RangeBlinker) TextAttributes(com.intellij.openapi.editor.markup.TextAttributes) Editor(com.intellij.openapi.editor.Editor) Segment(com.intellij.openapi.util.Segment)

Aggregations

Editor (com.intellij.openapi.editor.Editor)1 TextAttributes (com.intellij.openapi.editor.markup.TextAttributes)1 Segment (com.intellij.openapi.util.Segment)1 RangeBlinker (com.intellij.util.ui.RangeBlinker)1