Examples of HighlightRange


Examples of com.salesforce.ide.ui.editors.apex.util.ParserLocationTranslator.HighlightRange

    /*
     * Tries to highlight in the editor if we have a valid location
     */
    protected HighlightRange highlightTokenInEditorIfPossible(RealLoc loc) {
        HighlightRange range;
        try {
            range = ParserLocationTranslator.computeHighlightRange(loc, fEditor.getDocument());
            fEditor.setSelection(range, true);
            return range;
        } catch (BadLocationException e) {
View Full Code Here

Examples of com.salesforce.ide.ui.editors.apex.util.ParserLocationTranslator.HighlightRange

     * Tries to place the cursor on the token (0-length selection) if we have a valid location
     */
    protected HighlightRange placeCursorOnLineIfPossible(RealLoc loc) {
        try {
            int startOffset = ParserLocationTranslator.getStartOffset(loc, fEditor.getDocument());
            HighlightRange range = new HighlightRange(startOffset, 0);
            fEditor.setSelection(range, true);
            return range;
        } catch (BadLocationException e) {
            return null;
        }
View Full Code Here

Examples of org.graylog2.restclient.models.api.responses.HighlightRange

        // Current position in the message string.
        int position = 0;

        for (int idx = 0; idx < rangesList.size(); idx++) {
            final HighlightRange range = rangesList.get(idx);

            // Part before the next highlighted range of the message. (avoid empty chunks)
            if (position != range.getStart()) {
                list.add(new FieldChunk(message.substring(position, range.getStart()), true));
            }

            // The highlighted range of the message. Only allow the highlighting tags to be unescaped. The highlighted
            // part can contain HTML elements so that should be escaped.
            list.add(new FieldChunk("<span class=\"result-highlight\">",false));
            list.add(new FieldChunk(message.substring(range.getStart(), range.getStart() + range.getLength()), true));
            list.add(new FieldChunk("</span>", false));

            if ((idx + 1) < rangesList.size() && rangesList.get(idx + 1) != null) {
                // If there is another highlight range, add the part between the end of the current range and the start
                // of the next range.
                final HighlightRange nextRange = rangesList.get(idx + 1);

                list.add(new FieldChunk(message.substring(range.getStart() + range.getLength(), nextRange.getStart()), true));

                position = nextRange.getStart();
            } else {
                // If this range is the last, just add the rest of the message.
                list.add(new FieldChunk(message.substring(range.getStart() + range.getLength()), true));

                position = range.getStart() + range.getLength();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.