Package com.intellij.openapi.editor.ex

Examples of com.intellij.openapi.editor.ex.MarkupModelEx


    private void buildHighlighters(final String highlightText) {
        ApplicationManager.getApplication().assertIsDispatchThread();
        synchronized (items) {
            // aktuelle löschen
            final MarkupModelEx markupModel = (MarkupModelEx) editor.getMarkupModel();
            for (RangeHighlighter rangeHighlighter : items) {
                if (markupModel.containsHighlighter(rangeHighlighter)) {
                    markupModel.removeHighlighter(rangeHighlighter);
                }
            }
            items.clear();
            // und erstellen
            if (highlightText != null) {
                // text durchsuchen
                String text = editor.getDocument().getText();
                // textAttribute für RangeHighlighter holen
                final TextAttributes textAttributes = editor.getColorsScheme().getAttributes(BWACColorSettingsPage.BROWSEWORDATCARET);

                int index = -1;
                do {
                    index = text.indexOf(highlightText, index + 1);
                    // wenn gefunden und ganzes wort -> aufnehmen
                    if (index >= 0 && BWACUtils.isStartEnd(text, index, index + highlightText.length(), true)) {
                        RangeHighlighter rangeHighlighter = markupModel.addRangeHighlighter(index, index + highlightText.length(), HIGHLIGHTLAYER, textAttributes, HighlighterTargetArea.EXACT_RANGE);
                        rangeHighlighter.setErrorStripeTooltip(highlightText);
                        items.add(rangeHighlighter);
                    }
                } while (index >= 0);
            }
View Full Code Here

TOP

Related Classes of com.intellij.openapi.editor.ex.MarkupModelEx

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.