## org.autoplot.jythonsupport.ui.EditorAnnotationsSupport

annotations support for the editor, marking program counter position and errors. One way to get the support for an editor is getApplication().getScriptPanel().getAnnotationsSupport()

## ANNO_ERROR

error marked in the code

## ANNO_MAYBE_ERROR

error marked in the code with some uncertainty. We had a problem where this was mismarked, and we killed an hour very confused.

## ANNO_PROGRAM_COUNTER

current interpreter position

## ANNO_WARNING

warning in the code

## ANNO_CODE_HINT

warning in the code

## ANNO_USAGE

usage of a symbol in the code

## ANNO_INSERT

when rendering differences, insertion of text

## ANNO_DELETE

when rendering differences, deletion of text

## ANNO_CHANGE

when rendering differences, modification of text

## annotateChars

annotateChars( int line, int i0, int i1, String name, String text, PythonInterpreter interp ) → void

annotate the characters on the line. This was introduced to highlite the location of symbol names.

### Parameters

line - the line number, where 1 is the first line.
i0 - the column number, where 1 is the first column.
i1 - the last column number, exclusive.
name - annotation type, such as "usage" or "error" see constants.
text - the tooltip text.
interp - null or the interpreter.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]
annotateChars( int i0, int i1, String name, String text, PythonInterpreter interp ) → void [view source]

## annotateError

annotateError( PyException ex, int offset ) → void

mark the error in the editor by looking at the python exception to get the line number.

### Parameters

ex - the python exception
offset - line offset from beginning of file where execution began.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## annotateLine

annotateLine( int line, String name, String text ) → void

highlite the line by setting the background to color. null clears the highlite.

### Parameters

line - the line number to highlite. 1 is the first line.
name - the name of the style, including "error" and "programCounter"
text - annotation to display when hovering. Currently ignored.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## annotateLine

annotateLine( int lline, String name, String ltext, PythonInterpreter interp ) → void

highlite the line by setting the background to color. null clears the highlite.

### Parameters

lline - the line number to highlite. 1 is the first line.
name - the name of the style, including "error" and "programCounter"
ltext - annotation to display when hovering.
interp - the interpreter (or null) to focus on.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## clearAnnotations

clearAnnotations( ) → void

remove all annotations

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## clearAnnotations

clearAnnotations( int pos ) → void

remove all annotations at the position

### Parameters

pos - the position in character position within the document.

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getExpressionLookup

getExpressionLookup( ) → org.autoplot.jythonsupport.ui.EditorAnnotationsSupport.ExpressionLookup

### Returns:

org.autoplot.jythonsupport.ui.EditorAnnotationsSupport.ExpressionLookup
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getForInterp

getForInterp( PythonInterpreter interp ) → org.autoplot.jythonsupport.ui.EditorAnnotationsSupport.ExpressionLookup

### Parameters

interp - a PythonInterpreter

### Returns:

org.autoplot.jythonsupport.ui.EditorAnnotationsSupport.ExpressionLookup
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getLinePosition

getLinePosition( int line ) → int[]

return the position of the line in chars. The second is exclusive.

### Parameters

line - the line number 1 is the first line.

### Returns:

[st,en]
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getPreferredSize

getPreferredSize( ) → java.awt.Dimension

The editor component should delegate to these.

### Returns:

the preferred size
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getSymbolAt

getSymbolAt( org.autoplot.jythonsupport.ui.EditorTextPane editor, int position ) → String

return the symbol (e.g. variable name) at the caret position, or "".

### Parameters

editor - the code editor
position - typically editor.getCarotPosition

### Returns:

the symbol (e.g. variable name) at the current caret location
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## getToolTipText

getToolTipText( java.awt.event.MouseEvent me ) → String

The editor component should delegate to these.

### Parameters

me - a MouseEvent

### Returns:

the text
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## scrollToOffset

scrollToOffset( int offset ) → void

scroll to make sure offset is visible.

### Parameters

offset - an int

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]

## setExpressionLookup

setExpressionLookup( org.autoplot.jythonsupport.ui.EditorAnnotationsSupport.ExpressionLookup l ) → void

### Parameters

l - an EditorAnnotationsSupport.ExpressionLookup

### Returns:

void (returns nothing)
[search for examples] [view on GitHub] [view on old javadoc] [view source]