Interface SyntaxDecorator
-
Method Summary
Modifier and TypeMethodDescriptioncreateRichParagraph
(CodeTextModel model, int index) Creates aRichParagraph
with syntax decoration for the given paragraph index.void
handleChange
(CodeTextModel m, TextPos start, TextPos end, int charsTop, int linesAdded, int charsBottom) Receives the updates from the model, before any of the model'sStyledTextModel.Listener
s are notified.
-
Method Details
-
createRichParagraph
Creates aRichParagraph
with syntax decoration for the given paragraph index.For simple cases, when decorations can be generated using the paragraph text, it can be obtained by calling
BasicTextModel.getPlainText(int)
. This string is guaranteed to contain no control symbols except for TAB.Alternatively, the syntax decorator may cache the syntax information, or create
Marker
s at critical points in the model, or even perform processing in the background (provided the model supports concurrent access), culminating in sending a refresh even in the FX application thread by callingStyledTextModel.fireChangeEvent(TextPos, TextPos, int, int, int)
method.- Parameters:
model
- the modelindex
- the paragraph index- Returns:
- the decorated
RichParagraph
instance
-
handleChange
void handleChange(CodeTextModel m, TextPos start, TextPos end, int charsTop, int linesAdded, int charsBottom) Receives the updates from the model, before any of the model'sStyledTextModel.Listener
s are notified.The implementation might do nothing if the syntax can be determined based on the text of a single paragraph. Other implementations, which handle more complex syntax might want to re-build the syntax model any time the plain text document changes, should use this method to trigger the refresh.
- Parameters:
m
- the modelstart
- start of the affected rangeend
- end of the affected rangecharsTop
- number of characters added before any added paragraphslinesAdded
- number of paragraphs insertedcharsBottom
- number of characters added after any inserted paragraphs
-