Class orion.editor.AsyncStyler
Provides asynchronous styling for a TextView using registered "highlighter" services.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.editor/web/orion/editor/AsyncStyler.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.editor.AsyncStyler(textView, serviceRegistry, annotationModel)
Creates an
AsyncStyler . |
Method Attributes | Method Name and Description |
---|---|
destroy()
Deactivates this styler and removes any listeners it registered.
|
|
setContentType(contentTypeId)
Sets the content type ID for which style information will be provided.
|
AsyncStyler
. An AsyncStyler allows style information to be sent to a
TextView
asynchronously through the service segistry. Style is generated by style providers, which are services
having the 'orion.edit.highlighter'
service name and a type
=== 'highlighter'
service property.
A style provider monitors changes to the TextView (typically using an orion.edit.model
service) and
dispatches a service event of type 'orion.edit.highlighter.styleReady'
when it has style information to send.
The event carries a payload of style information for one or more lines in the TextView. The AsyncStyler then applies
the style information fron the event to the TextView using the orion.editor.TextView#event:onLineStyle API.
Applying style information may cause the TextView to be redrawn, which is potentially expensive. To minimize the number of redraws, a provider should provide style for many lines in a single StyleReadyEvent.
- Parameters:
- {orion.editor.TextView} textView
- The TextView to style.
- {orion.serviceregistry.ServiceRegistry} serviceRegistry
- The ServiceRegistry to monitor for highlighter services.
- {orion.editor.AnnotationModel} annotationModel Optional
- The Annotation Model to use for creating error and warning annotations.
setContentType(contentTypeId)
method.
In this way, a single provider service can be registered for several content types, and select different logic for each type.
- Parameters:
- {String} contentTypeId
- The Content Type ID describing the kind of file currently being edited in the TextView.