Class orion.editor.Editor
Extends
orion.editor.BaseEditor.
An Editor
is a user interface for editing text that provides additional features over the basic orion.editor.TextView.
Some of Editor
's features include:
- Additional actions and key bindings for editing text
- Content assist
- Find and Incremental Find
- Rulers for displaying line numbers and annotations
- Status reporting
Defined in: </jobs/genie.orion/orion-client-dev/workspace/bundles/org.eclipse.orion.client.editor/web/orion/editor/editor.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.editor.Editor(options)
Creates a new Editor with the given options.
|
Method Attributes | Method Name and Description |
---|---|
destroy()
Destroys the editor.
|
|
focus()
Gives focus to the text view.
|
|
Returns the annotation model of the editor.
|
|
Returns the annotation ruler of the editor.
|
|
Returns the annotation styler of the editor.
|
|
Returns the content assist of the editor.
|
|
Returns the folding ruler of the editor.
|
|
Returns the editor's key modes.
|
|
<static> |
orion.editor.Editor.getLineAtOffset(offset)
Returns the line number corresponding to the given offset in the source
|
getLineAtOffset(offset)
|
|
Returns the line number ruler of the editor.
|
|
getLineStart(line)
|
|
Returns the editor linked mode.
|
|
getModel()
Returns the base text model of this editor.
|
|
Returns the overview ruler of the editor.
|
|
getSelectionText(delimiter)
Returns the text view selection text.
|
|
Returns the editor source code actions.
|
|
Returns the editor text actions.
|
|
Returns the underlying
TextView used by this editor. |
|
Returns the Tooltip instance for this editor
|
|
Returns the zoom ruler of the editor.
|
|
install()
|
|
Creates the underlying TextView and installs the editor's features.
|
|
mapOffset(offset, _parent)
|
|
onGotoLine(line, column, end, callback)
Reveals a line in the editor, and optionally selects a portion of the line.
|
|
resize()
Resizes the text view.
|
|
setAnnotationRulerVisible(visible, force)
Sets whether the annotation ruler is visible.
|
|
setCaretOffset(caretOffset, show, callback)
|
|
setFoldingRulerVisible(visible, force)
Sets whether the folding ruler is visible.
|
|
setInput(title, message, contents, contentsSaved, noFocus)
Sets the editor's contents.
|
|
setLineNumberRulerVisible(visible, force)
Sets whether the line numbering ruler is visible.
|
|
setOverviewRulerVisible(visible, force)
Sets whether the overview ruler is visible.
|
|
setSelection(start, end, show, callback)
|
|
setSelections(ranges, show, callback)
|
|
setText(text, start, end, show, callback)
|
|
setZoomRulerVisible(visible, force)
Sets whether the zoom ruler is visible.
|
|
showAnnotations(annotations, types, createAnnotation, getType)
|
|
showBlame(blameMarkers)
|
|
showDiffAnnotations(diffs)
Display git diff annotation on the editor's annotation ruler and overview ruler.
|
|
showOccurrences(occurrences)
|
|
showProblems(problems)
|
|
showSelection(start, end, line, offset, length)
Reveals and selects a portion of text.
|
|
Destroys the underlying TextView.
|
- Methods borrowed from class orion.editor.BaseEditor:
- addEventListener, dispatchEvent, getText, getTitle, getUndoStack, isDirty, markClean, onChanged, onDirtyChanged, onInputChanged, removeEventListener, reportStatus, setDirty
Class Detail
orion.editor.Editor(options)
Creates a new Editor with the given options.
- Parameters:
- {Object} options
- Options controlling the features of this Editor.
- {Object} options.annotationFactory
- {Object} options.contentAssistFactory
- {Object} options.domNode
- {Object} options.keyBindingFactory
- {Object} options.lineNumberRulerFactory
- {Object} options.zoomRulerFactory
- {Object} options.foldingRulerFactory
- {Object} options.statusReporter
- {Object} options.textViewFactory
- {Object} options.undoStackFactory
- {Object} options.textDNDFactory
- {Object} options.hoverFactory
Method Detail
destroy()
Destroys the editor.
focus()
Gives focus to the text view.
{orion.editor.AnnotationModel}
getAnnotationModel()
Returns the annotation model of the editor.
- Returns:
- {orion.editor.AnnotationModel}
{orion.editor.AnnotationRuler}
getAnnotationRuler()
Returns the annotation ruler of the editor.
- Returns:
- {orion.editor.AnnotationRuler}
{orion.editor.AnnotationStyler}
getAnnotationStyler()
Returns the annotation styler of the editor.
- Returns:
- {orion.editor.AnnotationStyler}
getCaretOffset()
{orion.editor.LineNumberRuler}
getContentAssist()
Returns the content assist of the editor.
- Returns:
- {orion.editor.LineNumberRuler}
{orion.editor.FoldingRuler}
getFoldingRuler()
Returns the folding ruler of the editor.
- Returns:
- {orion.editor.FoldingRuler}
{Array}
getKeyModes()
Returns the editor's key modes.
- Returns:
- {Array} the editor key modes.
<static>
{Number}
orion.editor.Editor.getLineAtOffset(offset)
Returns the line number corresponding to the given offset in the source
- Parameters:
- {Number} offset
- The offset into the source
- Since:
- 5.0
- Returns:
- {Number} The line number corresponding to the given offset or
-1
if out of range
getLineAtOffset(offset)
- Parameters:
- offset
{orion.editor.LineNumberRuler}
getLineNumberRuler()
Returns the line number ruler of the editor.
- Returns:
- {orion.editor.LineNumberRuler}
getLineStart(line)
- Parameters:
- line
{orion.editor.LinkedMode}
getLinkedMode()
Returns the editor linked mode.
- Returns:
- {orion.editor.LinkedMode}
{orion.editor.TextModel}
getModel()
Returns the base text model of this editor.
- Returns:
- {orion.editor.TextModel}
{orion.editor.OverviewRuler}
getOverviewRuler()
Returns the overview ruler of the editor.
- Returns:
- {orion.editor.OverviewRuler}
getSelection()
getSelections()
{String}
getSelectionText(delimiter)
Returns the text view selection text.
If there are multiple selection ranges, the result is concatenated with the specified delimiter.
- Parameters:
- {String} delimiter
- The offset into the editor
- Since:
- 10.0
- Returns:
- {String} the view selection text
{orion.editor.sourceCodeActions}
getSourceCodeActions()
Returns the editor source code actions.
- Returns:
- {orion.editor.sourceCodeActions}
getStyleAccessor()
{orion.editor.textActions}
getTextActions()
Returns the editor text actions.
- Returns:
- {orion.editor.textActions}
{orion.editor.TextView}
getTextView()
Returns the underlying
TextView
used by this editor.
- Returns:
- {orion.editor.TextView} the editor text view.
{orion.editor.Tooltip}
getTooltip()
Returns the Tooltip instance for this editor
- Returns:
- {orion.editor.Tooltip}
{orion.editor.LineNumberRuler}
getZoomRuler()
Returns the zoom ruler of the editor.
- Returns:
- {orion.editor.LineNumberRuler}
install()
installTextView()
Creates the underlying TextView and installs the editor's features.
mapOffset(offset, _parent)
- Parameters:
- offset
- _parent
onGotoLine(line, column, end, callback)
Reveals a line in the editor, and optionally selects a portion of the line.
- Parameters:
- {Number} line
- - document base line index
- {Number|String} column
- {Number} end Optional
- callback
resize()
Resizes the text view.
setAnnotationRulerVisible(visible, force)
Sets whether the annotation ruler is visible.
- Parameters:
- {Boolean} visible
true
to show ruler,false
otherwise- force
setCaretOffset(caretOffset, show, callback)
- Parameters:
- caretOffset
- show
- callback
setFoldingRulerVisible(visible, force)
Sets whether the folding ruler is visible.
- Parameters:
- {Boolean} visible
true
to show ruler,false
otherwise- force
setInput(title, message, contents, contentsSaved, noFocus)
Sets the editor's contents.
- Parameters:
- {String} title
- {String} message
- {String} contents
- {Boolean} contentsSaved
- {Boolean} noFocus
setLineNumberRulerVisible(visible, force)
Sets whether the line numbering ruler is visible.
- Parameters:
- {Boolean} visible
true
to show ruler,false
otherwise- force
setOverviewRulerVisible(visible, force)
Sets whether the overview ruler is visible.
- Parameters:
- {Boolean} visible
true
to show ruler,false
otherwise- force
setSelection(start, end, show, callback)
- Parameters:
- start
- end
- show
- callback
setSelections(ranges, show, callback)
- Parameters:
- ranges
- show
- callback
setText(text, start, end, show, callback)
- Parameters:
- text
- start
- end
- show
- callback
setZoomRulerVisible(visible, force)
Sets whether the zoom ruler is visible.
- Parameters:
- {Boolean} visible
true
to show ruler,false
otherwise- force
showAnnotations(annotations, types, createAnnotation, getType)
- Parameters:
- annotations
- types
- createAnnotation
- getType
showBlame(blameMarkers)
- Parameters:
- blameMarkers
showDiffAnnotations(diffs)
Display git diff annotation on the editor's annotation ruler and overview ruler.
- Parameters:
- diffs
- [] with types "added", "modified", "deleted" Each property in diffs contains an array of objects { lineStart, lineEnd } that provides the starting and ending line index for the specified property.
showOccurrences(occurrences)
- Parameters:
- occurrences
showProblems(problems)
- Parameters:
- problems
showSelection(start, end, line, offset, length)
Reveals and selects a portion of text.
- Parameters:
- {Number} start
- {Number} end
- {Number} line
- {Number} offset
- {Number} length
uninstall()
uninstallTextView()
Destroys the underlying TextView.