|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface Editor
Represents an editor view used to display and interactively modify the contents of a Java source file.
Method Summary | |
---|---|
void |
attachAnnotations(java.util.List annotations)
Attaches the given annotations to this view. |
java.util.List |
detachAnnotations()
Detaches all existing annotations of this view. |
int |
getCaretPosition()
Returns the current location of the caret. |
int |
getColumn()
Returns the column offset in the current line. |
ProjectFile |
getFile()
Returns the file of the editor. |
int |
getLength()
Returns the number of characters in the editor document. |
int |
getLine()
Returns the current line number. |
java.lang.String |
getSelectedText()
Returns the selected text contained in this editor. |
int |
getSelectionEnd()
Returns the selected text's end position. |
int |
getSelectionStart()
Returns the selected text's start position. |
java.lang.String |
getText()
Returns the text contained in this editor. |
void |
paste(java.lang.String text)
Replaces the currently selected content with new content represented by the given string. |
void |
requestFocus()
Tries to set the focus on the receiving component. |
void |
selectAll()
Selects the whole text of the editor. |
void |
setCaretPosition(int offset)
Moves the caret to the given location. |
void |
setCaretPosition(int line,
int column)
Moves the caret to the given location. |
void |
setSelection(int startOffset,
int endOffset)
Selects the specified text. |
void |
setText(java.lang.String text)
Sets the text of this editor to the specified text. |
Method Detail |
---|
void setCaretPosition(int offset)
offset
- the text offset where the caret should be placed (absolute character
position).
java.lang.IllegalArgumentException
- if offset < 0 ||
offset > getLength()
void setCaretPosition(int line, int column)
line
- line number.column
- column offset in the given line.
java.lang.IllegalArgumentException
- if line < 1 || column
< 1
int getCaretPosition()
>=
0
).int getColumn()
>= 1
).ProjectFile getFile()
int getLength()
>= 0
).int getLine()
>= 1
).java.lang.String getSelectedText()
null
.void setSelection(int startOffset, int endOffset)
startOffset
- the offset you wish to start selection on (absolute character
position).endOffset
- the offset you wish to end selection on (absolute character
position).
java.lang.IllegalArgumentException
- if startOffset < 0 ||
endOffset < 0
int getSelectionEnd()
>=0
). Returns
0
if the document is empty, or the position of the caret if
there is no selection.int getSelectionStart()
>=0
). Returns 0
for an
empty document, or the position of the caret if there is no selection.void setText(java.lang.String text)
null
or empty, has the effect of simply deleting the old text.
text
- the new text to be set.java.lang.String getText()
void attachAnnotations(java.util.List annotations)
annotations
- list of annotations (of type <Annotation>
) to attach.Annotation
java.util.List detachAnnotations()
<Annotation>
). Returns an
empty list, if no annotations were attached.attachAnnotations(java.util.List)
void paste(java.lang.String text)
text
- the string to replace the selection with.void requestFocus()
void selectAll()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |