Example usage for com.intellij.openapi.options.colors ColorSettingsPage getAdditionalHighlightingTagToDescriptorMap

List of usage examples for com.intellij.openapi.options.colors ColorSettingsPage getAdditionalHighlightingTagToDescriptorMap

Introduction

In this page you can find the example usage for com.intellij.openapi.options.colors ColorSettingsPage getAdditionalHighlightingTagToDescriptorMap.

Prototype

@Nullable
Map<String, TextAttributesKey> getAdditionalHighlightingTagToDescriptorMap();

Source Link

Document

Returns the mapping from special tag names surrounding the regions to be highlighted in the preview text (see #getDemoText() ) to text attribute keys used to highlight the regions.

Usage

From source file:com.intellij.application.options.colors.SimpleEditorPreview.java

License:Apache License

public SimpleEditorPreview(final ColorAndFontOptions options, final ColorSettingsPage page,
        final boolean navigatable) {
    myOptions = options;//from w ww. j  a va2s.c o  m
    myPage = page;

    String text = page.getDemoText();

    HighlightsExtractor extractant2 = new HighlightsExtractor(
            page.getAdditionalHighlightingTagToDescriptorMap());
    List<HighlightData> highlights = new ArrayList<HighlightData>();
    String stripped = extractant2.extractHighlights(text, highlights);
    myHighlightData = highlights.toArray(new HighlightData[highlights.size()]);
    int selectedLine = -1;
    myEditor = (EditorEx) FontEditorPreview.createPreviewEditor(stripped, 10, 3, selectedLine, myOptions,
            false);

    FontEditorPreview.installTrafficLights(myEditor);
    myBlinkingAlarm = new Alarm().setActivationComponent(myEditor.getComponent());
    if (navigatable) {
        addMouseMotionListener(myEditor, page.getHighlighter(), myHighlightData, false);

        CaretListener listener = new CaretAdapter() {
            @Override
            public void caretPositionChanged(CaretEvent e) {
                navigate(myEditor, true, e.getNewPosition(), page.getHighlighter(), myHighlightData, false);
            }
        };
        myEditor.getCaretModel().addCaretListener(listener);
    }
}