Class orion.textview.Ruler
This interface represents a ruler for the text view.
A Ruler is a graphical element that is placed either on the left or on the right side of the view. It can be used to provide the view with per line decoration such as line numbering, bookmarks, breakpoints, folding disclosures, etc.
There are two types of rulers: page and document. A page ruler only shows the content for the lines that are visible, while a document ruler always shows the whole content.
See:orion.textview.LineNumberRuler
orion.textview.AnnotationRuler
orion.textview.OverviewRuler
orion.textview.TextView
orion.textview.TextView#addRuler
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/rulers.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.textview.Ruler(annotationModel, rulerLocation, rulerOverview, rulerStyle)
Constructs a new ruler.
|
Method Attributes | Method Name and Description |
---|---|
addAnnotationType(type)
Adds an annotation type to the receiver.
|
|
Returns the annotation model.
|
|
getAnnotations(startLine, endLine)
Returns the annotations for a given line range merging multiple
annotations when necessary.
|
|
getAnnotationsByType(annotationModel, start, end)
Returns an array of annotations in the specified annotation model for the given range of text sorted by type.
|
|
Gets the annotation type priority.
|
|
Returns the ruler location.
|
|
Returns the ruler overview type.
|
|
Returns the style information for the ruler.
|
|
getView()
Returns the text view.
|
|
Returns the widest annotation which determines the width of the ruler.
|
|
isAnnotationTypeVisible(type)
Returns whether the receiver shows annotations of the specified type.
|
|
removeAnnotationType(type)
Removes an annotation type from the receiver.
|
|
setAnnotationModel(annotationModel)
Sets the annotation model for the ruler.
|
|
setMultiAnnotation(annotation)
Sets the annotation that is displayed when a given line contains multiple
annotations.
|
|
setMultiAnnotationOverlay(annotation)
Sets the annotation that overlays a line with multiple annotations.
|
|
setView(view)
Sets the view for the ruler.
|
Event Attributes | Event Name and Description |
---|---|
onClick(lineIndex, e)
This event is sent when the user clicks a line annotation.
|
|
onDblClick(lineIndex, e)
This event is sent when the user double clicks a line annotation.
|
|
onMouseMove(lineIndex, e)
This event is sent when the user moves the mouse over a line annotation.
|
|
onMouseOut(lineIndex, e)
This event is sent when the mouse pointer exits a line annotation.
|
|
onMouseOver(lineIndex, e)
This event is sent when the mouse pointer enters a line annotation.
|
The default implementation does not implement all the methods in the interface and is useful only for objects implementing rulers.
- Parameters:
- {orion.textview.AnnotationModel} annotationModel
- the annotation model for the ruler.
- {String} rulerLocation Optional, Default: "left"
- the location for the ruler.
- {String} rulerOverview Optional, Default: "page"
- the overview for the ruler.
- {orion.textview.Style} rulerStyle Optional
- the style for the ruler.
Only annotations of the specified types will be shown by the receiver.
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/annotations.js>.
- Parameters:
- {Object} type
- the annotation type to be shown
- Returns:
- {orion.textview.AnnotationModel} the ruler annotation model.
- See:
- #setAnnotationModel
This method is called by the text view when the ruler is redrawn.
- Parameters:
- {Number} startLine
- the start line index
- {Number} endLine
- the end line index
- Returns:
- {orion.textview.Annotation[]} the annotations for the line range. The array might be sparse.
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/annotations.js>.
- Parameters:
- {orion.textview.AnnotationModel} annotationModel
- the annotation model.
- {Number} start
- the start offset of the range.
- {Number} end
- the end offset of the range.
- Returns:
- {orion.textview.Annotation[]} an annotation array.
Returns 0
if the annotation type is not added.
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/annotations.js>.
- Parameters:
- {Object} type
- the annotation type
- Returns:
- {String} the ruler location, which is either "left" or "right".
- See:
- #getOverview
- Returns:
- {String} the overview type, which is either "page" or "document".
- See:
- #getLocation
- Returns:
- {orion.textview.Style} the style information.
- Returns:
- {orion.textview.TextView} the text view.
- See:
- #setView
If the ruler does not have a fixed width it should provide the widest annotation to avoid the ruler from changing size as the view scrolls.
This method is called by the text view when the ruler is redrawn.
- Returns:
- {orion.textview.Annotation} the widest annotation.
- See:
- #getAnnotations
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/annotations.js>.
- Parameters:
- {Object} type
- the annotation type
- Returns:
- {Boolean} whether the specified annotation type is shown
Defined in: </shared/eclipse/e4/orion/I201301232230/plugins/org.eclipse.orion.client.editor/web/orion/textview/annotations.js>.
- Parameters:
- {Object} type
- the annotation type to be removed
- Parameters:
- {orion.textview.AnnotationModel} annotationModel
- the annotation model.
- See:
- #getAnnotationModel
- Parameters:
- {orion.textview.Annotation} annotation
- the annotation for lines with multiple annotations.
- Parameters:
- {orion.textview.Annotation} annotation
- the annotation overlay for lines with multiple annotations.
- See:
- #setMultiAnnotation
This method is called by the text view when the ruler is added to the view.
- Parameters:
- {orion.textview.TextView} view
- the text view.
- Parameters:
- {Number} lineIndex
- the line index of the annotation under the pointer.
- {DOMEvent} e
- the click event.
- Parameters:
- {Number} lineIndex
- the line index of the annotation under the pointer.
- {DOMEvent} e
- the double click event.
- Parameters:
- {Number} lineIndex
- the line index of the annotation under the pointer.
- {DOMEvent} e
- the mouse move event.
- Parameters:
- {Number} lineIndex
- the line index of the annotation under the pointer.
- {DOMEvent} e
- the mouse out event.
- Parameters:
- {Number} lineIndex
- the line index of the annotation under the pointer.
- {DOMEvent} e
- the mouse over event.