All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.fife.ui.rsyntaxtextarea.spell.SpellingParserNotice Maven / Gradle / Ivy

Go to download

A simple spell checker add-on for RSyntaxTextArea. It will spell-check comments in source code, or the entire file if you are editing plain text. Spelling errors are squiggle-underlined with the color of your choice, and tooltips are available offering any spelling suggestions.

The newest version!
/*
 * This library is distributed under the LGPL.  See the included
 * LICENSE.md file for details.
 */
package org.fife.ui.rsyntaxtextarea.spell;

import org.fife.com.swabunga.spell.event.SpellChecker;
import org.fife.ui.rsyntaxtextarea.parser.DefaultParserNotice;

import java.awt.*;

/**
 * A parser notice for spelling errors.
 */
class SpellingParserNotice extends DefaultParserNotice {

    private String word;
    private SpellChecker sc;

    SpellingParserNotice(SpellingParser parser, String msg,
                         int line, int offs, String word,
                         SpellChecker sc) {
        super(parser, msg, line, offs, word.length());
        setLevel(Level.INFO);
        this.word = word;
        this.sc = sc;
    }

    @Override
    public Color getColor() {
        return ((SpellingParser)getParser()).getSquiggleUnderlineColor();
    }

    @Override
    public String getToolTipText() {
        return new SpellingErrorTooltipHtmlGenerator().get(sc, this);
    }

    /**
     * Returns the incorrectly spelled word.
     *
     * @return The word.
     */
    public String getWord() {
        return word;
    }

    @Override
    public String toString() {
        return "[SpellingParserNotice: " + word + "]";
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy