Code Pane
A text suitable for editing Avail source code. It is editable by default, but may be locked down after construction.
Currently supports:
Basic editing.
Basic undo/redo.
Template expansion, with prefix shortening and explicit single caret positioning.
Author
Todd L Smith
Parameters
The associated AvailWorkbench.
The editor kit.
Constructors
Construct a CodePane.
Types
The state of an ongoing template selection.
Properties
Whether the receiver can really be edited.
Given a JTextPane that has previously had scrollTextWithLineNumbers run against it to wrap it appropriately before adding to the component hierarchy, extract the CodeOverlay associated with it. If it doesn't have one, fail.
Functions
Center the current line of the receiver in its enclosing viewport by moving the caret. If no viewport encloses the receiver, then do not move the caret.
Change the font to the provided font name and size.
Change the font size to the provided font size.
Clear the template selection state iff it is stale.
Locate the position of the beginning of the first line enclosing the active selection.
Move the caret to the specified line and optional intra-line position. Normalize the positions, to ensure that the document and line limits are not exceeded.
Locate the position of the end of the last line enclosing the active selection.
Locate the ends of all lines enclosing the active selection. If no text is selected, then locate the end of the line containing the caret.
Locate the beginnings of all lines enclosing the active selection. If no text is selected, then locate the beginning of the line containing the caret.
Either places the given component inside a JScrollPane or answers the JScrollPane that it's already inside.
Create or look up the JLayer that contains a JScrollPane holding the receiver JTextPane plus a CodeOverlay that manages line numbers as row headers, line guides, and whatever else a CodeOverlay presents.
Set the caret dot and caret mark from the given MarkToDotRange.
Scroll the given JTextPane to ensure the given text range is visible, and preferably not jammed against the top or bottom border.