Package flow.netbeans.markdown.spellchecker

Source Code of flow.netbeans.markdown.spellchecker.MarkdownTokenListProvider

package flow.netbeans.markdown.spellchecker;

import flow.netbeans.markdown.csl.MarkdownLanguageConfig;
import javax.swing.text.Document;
import org.netbeans.api.editor.mimelookup.MimeRegistration;
import org.netbeans.editor.BaseDocument;
import org.netbeans.modules.spellchecker.spi.language.TokenList;
import org.netbeans.modules.spellchecker.spi.language.TokenListProvider;

/**
*
* @author Holger Stenger
*/
@MimeRegistration(mimeType = MarkdownLanguageConfig.MIME_TYPE,
                  service = TokenListProvider.class, position = 1000)
public class MarkdownTokenListProvider implements TokenListProvider {

    public MarkdownTokenListProvider() {
    }

    @Override
    public TokenList findTokenList(Document doc) {
        if (doc instanceof BaseDocument) {
            BaseDocument baseDoc = (BaseDocument) doc;
            final Object mimeType = baseDoc.getProperty("mimeType");
            if (MarkdownLanguageConfig.MIME_TYPE.equals(mimeType)) {
                return new MarkdownTokenList(doc);
            }
        }
        return null;
    }
}
TOP

Related Classes of flow.netbeans.markdown.spellchecker.MarkdownTokenListProvider

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.