public class SourceBuffer extends TextBuffer
SourceView
. It extends GTK's
TextBuffer
and adds features typical for text editors. SourceBuffer
contains the actual text that is displayed in the view and allows its
manipulation.
TextTagTable table; SourceBuffer buffer; ... table = new TextTagTable(); buffer = new SourceBuffer(); buffer.setText("Insert text here...");The language used for syntax highlighting has to be obtained from the LanguageManager:
manager = LanguageManager.getDefault(); language = manager.getLanguage("java"); buffer.setLanguage(language);
TextBuffer.ApplyTag, TextBuffer.BeginUserAction, TextBuffer.Changed, TextBuffer.DeleteRange, TextBuffer.EndUserAction, TextBuffer.InsertText, TextBuffer.MarkSet, TextBuffer.NotifyCursorPosition, TextBuffer.RemoveTag
OBJECT_REPLACEMENT_CHARACTER
Constructor and Description |
---|
SourceBuffer()
Create a new SourceBuffer.
|
SourceBuffer(TextTagTable tags)
Create a new SourceBuffer using the given TextTagTable.
|
Modifier and Type | Method and Description |
---|---|
void |
beginNotUndoableAction()
Indicate the beginning of an action that cannot be undone.
|
boolean |
canRedo()
Return
true if an operation can be redone. |
boolean |
canUndo()
Return
true if an operation can be undone. |
void |
endNotUndoableAction()
Indicate the end of an action that cannot be undone.
|
boolean |
getHighlightMatchingBrackets()
Return whether matching brackets are highlighted.
|
boolean |
getHighlightSyntax()
Return whether syntax highlighting is enabled or not.
|
Language |
getLanguage()
Get the Language that is used for syntax highlighting.
|
StyleScheme |
getStyleScheme()
Get the
StyleScheme that is used. |
void |
redo()
Redo the last undone operation.
|
void |
setHighlightMatchingBrackets(boolean highlight)
Enable or disable highlighting of matching brackets.
|
void |
setHighlightSyntax(boolean highlight)
Enable/disable syntax higlighting.
|
void |
setLanguage(Language language)
Set the Language that is used for syntax highlighting.
|
void |
setStyleScheme(StyleScheme scheme)
Set the
StyleScheme that is used. |
void |
undo()
Undo the last operation.
|
applyTag, applyTag, beginUserAction, connect, connect, connect, connect, connect, connect, connect, connect, connect, connectAfter, createMark, delete, deleteInteractive, endUserAction, getCharCount, getCursorPosition, getHasSelection, getInsert, getIter, getIter, getIterEnd, getIterStart, getLineCount, getModified, getSelectionBound, getSlice, getText, getText, insert, insert, insert, insert, insert, insert, insertAtCursor, insertInteractive, moveMark, placeCursor, removeAllTags, removeTag, selectRange, setModified, setText, stopDeleteRange, stopInsertText
public SourceBuffer()
<init>()
for
details.public SourceBuffer(TextTagTable tags)
public void beginNotUndoableAction()
public boolean canRedo()
true
if an operation can be redone.public boolean canUndo()
true
if an operation can be undone.public void endNotUndoableAction()
public boolean getHighlightMatchingBrackets()
public boolean getHighlightSyntax()
public Language getLanguage()
public StyleScheme getStyleScheme()
StyleScheme
that is used.public void redo()
canRedo()
.public void setHighlightMatchingBrackets(boolean highlight)
public void setHighlightSyntax(boolean highlight)
setLanguage
. Highlighting is enabled by default.public void setLanguage(Language language)
public void setStyleScheme(StyleScheme scheme)
StyleScheme
that is used.public void undo()
canUndo()
.