Class DocumentSpellingListener

  • All Implemented Interfaces:
    org.eclipse.jface.text.IDocumentListener

    public class DocumentSpellingListener
    extends Object
    implements org.eclipse.jface.text.IDocumentListener
    Special IDocumentListener for checking spelling in BSL language
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected org.eclipse.xtext.ui.editor.model.ITokenTypeToPartitionTypeMapperExtension partitionMapperExtension  
      protected org.eclipse.jface.text.source.ISourceViewer sourceViewer  
      protected org.eclipse.ui.texteditor.spelling.SpellingContext spellingContext  
      protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector spellingProblemCollector  
      protected org.eclipse.ui.texteditor.spelling.SpellingService spellingService  
    • Constructor Summary

      Constructors 
      Constructor Description
      DocumentSpellingListener​(org.eclipse.jface.text.IDocument document, org.eclipse.jface.text.source.ISourceViewer viewer, org.eclipse.ui.texteditor.spelling.SpellingService spellingService, org.eclipse.xtext.ui.editor.model.ITokenTypeToPartitionTypeMapperExtension partitionMapperExtension)
      Constructor
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      protected void checkSpelling​(org.eclipse.jface.text.IDocument document)
      Checks spelling in all content of document.
      protected org.eclipse.jface.text.ITypedRegion[] computePartitioning​(org.eclipse.jface.text.IDocument document, int offset, int length, String partitionType)
      Computes and returns the partitioning for the given region of the given document for the given partitioning name
      protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector createSpellingProblemCollector()
      Gets actual ISpellingProblemCollector for collect processing SpellingAnnotation for current document
      void documentAboutToBeChanged​(org.eclipse.jface.text.DocumentEvent event)  
      void documentChanged​(org.eclipse.jface.text.DocumentEvent event)  
      protected org.eclipse.jface.text.source.IAnnotationModel getAnnotationModel()
      Get current IAnnotationModel for ISourceViewer
      protected org.eclipse.core.runtime.content.IContentType getContentType()
      Returns the content type of the underlying editor input.
      protected boolean isSpellingEnabled()
      Checks that checking spelling enable
      protected boolean shouldProcess​(org.eclipse.jface.text.ITypedRegion typedRegion)
      Checks that typedRegion should be processed by spelling engine
    • Field Detail

      • sourceViewer

        protected org.eclipse.jface.text.source.ISourceViewer sourceViewer
      • spellingService

        protected org.eclipse.ui.texteditor.spelling.SpellingService spellingService
      • spellingProblemCollector

        protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector spellingProblemCollector
      • spellingContext

        protected org.eclipse.ui.texteditor.spelling.SpellingContext spellingContext
      • partitionMapperExtension

        protected org.eclipse.xtext.ui.editor.model.ITokenTypeToPartitionTypeMapperExtension partitionMapperExtension
    • Constructor Detail

      • DocumentSpellingListener

        public DocumentSpellingListener​(org.eclipse.jface.text.IDocument document,
                                        org.eclipse.jface.text.source.ISourceViewer viewer,
                                        org.eclipse.ui.texteditor.spelling.SpellingService spellingService,
                                        org.eclipse.xtext.ui.editor.model.ITokenTypeToPartitionTypeMapperExtension partitionMapperExtension)
        Constructor
        Parameters:
        document - actual document for checking spelling, can't be null
        viewer - actual ISourceViewer, can't be null
        spellingService - current SpellingService, can't be null
        partitionMapperExtension - special ITokenTypeToPartitionTypeMapperExtension for Bsl language, can't be null
    • Method Detail

      • documentAboutToBeChanged

        public void documentAboutToBeChanged​(org.eclipse.jface.text.DocumentEvent event)
        Specified by:
        documentAboutToBeChanged in interface org.eclipse.jface.text.IDocumentListener
      • documentChanged

        public void documentChanged​(org.eclipse.jface.text.DocumentEvent event)
        Specified by:
        documentChanged in interface org.eclipse.jface.text.IDocumentListener
      • checkSpelling

        protected void checkSpelling​(org.eclipse.jface.text.IDocument document)
        Checks spelling in all content of document. Spelling will be checked only in string literals and comments
        Parameters:
        document - actual document for checking spelling, can't be null
      • computePartitioning

        protected org.eclipse.jface.text.ITypedRegion[] computePartitioning​(org.eclipse.jface.text.IDocument document,
                                                                            int offset,
                                                                            int length,
                                                                            String partitionType)
        Computes and returns the partitioning for the given region of the given document for the given partitioning name
        Parameters:
        Computes - and returns the partitioning for the given region of the given document for the given partitioning name
        offset - beginning offset for part
        length - length of partitioning content from offset
        partitionType - default partitioning type, can't be null
        Returns:
        computed ITypedRegion for the given region of the given document for the given partitioning name
      • shouldProcess

        protected boolean shouldProcess​(org.eclipse.jface.text.ITypedRegion typedRegion)
        Checks that typedRegion should be processed by spelling engine
        Parameters:
        typedRegion - checking ITypedRegion, can't be null
        Returns:
        true if typedRegion should be processed by spelling engine, false otherwise
      • isSpellingEnabled

        protected boolean isSpellingEnabled()
        Checks that checking spelling enable
        Returns:
        true if checking spelling enable, false otherwise
      • getContentType

        protected org.eclipse.core.runtime.content.IContentType getContentType()
        Returns the content type of the underlying editor input.
        Returns:
        the content type of the underlying editor input or null if none could be determined
      • getAnnotationModel

        protected org.eclipse.jface.text.source.IAnnotationModel getAnnotationModel()
        Get current IAnnotationModel for ISourceViewer
        Returns:
        current IAnnotationModel for ISourceViewer can be null
      • createSpellingProblemCollector

        protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector createSpellingProblemCollector()
        Gets actual ISpellingProblemCollector for collect processing SpellingAnnotation for current document
        Returns:
        actual ISpellingProblemCollector, can be null if there is no IAnnotationModel