Package com._1c.g5.v8.dt.bsl.ui.editor
Class DocumentSpellingListener
- java.lang.Object
-
- com._1c.g5.v8.dt.bsl.ui.editor.DocumentSpellingListener
-
- All Implemented Interfaces:
org.eclipse.jface.text.IDocumentListener
public class DocumentSpellingListener extends Object implements org.eclipse.jface.text.IDocumentListener
SpecialIDocumentListener
for checking spelling in BSL language
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static class
DocumentSpellingListener.SpellingProblemCollector
Spelling problem collector.
-
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 ofdocument
.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 nameprotected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector
createSpellingProblemCollector()
Gets actualISpellingProblemCollector
for collect processingSpellingAnnotation
for current documentvoid
documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
void
documentChanged(org.eclipse.jface.text.DocumentEvent event)
protected org.eclipse.jface.text.source.IAnnotationModel
getAnnotationModel()
Get currentIAnnotationModel
forISourceViewer
protected org.eclipse.core.runtime.content.IContentType
getContentType()
Returns the content type of the underlying editor input.protected boolean
isSpellingEnabled()
Checks that checking spelling enableprotected boolean
shouldProcess(org.eclipse.jface.text.ITypedRegion typedRegion)
Checks thattypedRegion
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 benull
viewer
- actualISourceViewer
, can't benull
spellingService
- currentSpellingService
, can't benull
partitionMapperExtension
- specialITokenTypeToPartitionTypeMapperExtension
for Bsl language, can't benull
-
-
Method Detail
-
documentAboutToBeChanged
public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
- Specified by:
documentAboutToBeChanged
in interfaceorg.eclipse.jface.text.IDocumentListener
-
documentChanged
public void documentChanged(org.eclipse.jface.text.DocumentEvent event)
- Specified by:
documentChanged
in interfaceorg.eclipse.jface.text.IDocumentListener
-
checkSpelling
protected void checkSpelling(org.eclipse.jface.text.IDocument document)
Checks spelling in all content ofdocument
. Spelling will be checked only in string literals and comments- Parameters:
document
- actual document for checking spelling, can't benull
-
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 nameoffset
- beginning offset for partlength
- length of partitioning content fromoffset
partitionType
- default partitioning type, can't benull
- 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 thattypedRegion
should be processed by spelling engine- Parameters:
typedRegion
- checkingITypedRegion
, can't benull
- Returns:
true
iftypedRegion
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 currentIAnnotationModel
forISourceViewer
- Returns:
- current
IAnnotationModel
forISourceViewer
can benull
-
createSpellingProblemCollector
protected org.eclipse.ui.texteditor.spelling.ISpellingProblemCollector createSpellingProblemCollector()
Gets actualISpellingProblemCollector
for collect processingSpellingAnnotation
for current document- Returns:
- actual
ISpellingProblemCollector
, can benull
if there is noIAnnotationModel
-
-