java.lang.Object
org.gjt.sp.jedit.buffer.JEditBuffer
- Direct Known Subclasses:
Buffer
A
JEditBuffer
represents the contents of an open text
file as it is maintained in the computer's memory (as opposed to
how it may be stored on a disk).This class is partially thread-safe, however you must pay attention to two very important guidelines:
- Operations such as insert() and remove(), undo(), change Buffer data in a writeLock(), and must be called from the AWT thread.
- When accessing the buffer from another thread, you must call readLock() before and readUnLock() after, if you plan on performing more than one read, to ensure that the buffer contents are not changed by the AWT thread for the duration of the lock. Only methods whose descriptions specify thread safety can be invoked from other threads.
- Since:
- jEdit 4.3pre3
- Version:
- $Id: JEditBuffer.java 25279 2020-04-20 22:08:37Z kpouer $
- Author:
- Slava Pestov
-
Nested Class Summary
-
Field Summary
Modifier and TypeFieldDescriptionfinal Object
protected boolean
If true the syntax highlight is context insensitive.boolean
This field should be read instead of "elasticTabstops" property when efficiency matters.static final String
Character encoding used when loading and saving.static final int
static final String
Line separator property.protected Mode
The edit mode of the buffer.static final int
protected TokenMarker
protected UndoManager
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionvoid
addBufferListener
(BufferListener listener) Adds a buffer change listener.void
addBufferListener
(BufferListener listener, int priority) Adds a buffer change listener.void
Starts a compound edit.boolean
canRedo()
boolean
canUndo()
createPosition
(int offset) Creates a floating position (javax.swing.text.Position
).void
Ends a compound edit.protected void
protected void
protected void
protected void
fireContentInserted
(int startLine, int offset, int numLines, int length) protected void
fireContentRemoved
(int startLine, int offset, int numLines, int length) protected void
protected void
protected void
protected void
fireFoldLevelChanged
(int start, int end) protected void
firePreContentInserted
(int startLine, int offset, int numLines, int length) protected void
firePreContentRemoved
(int startLine, int offset, int numLines, int length) protected void
boolean
getBooleanProperty
(String name) boolean
getBooleanProperty
(String name, boolean def) getContextSensitiveProperty
(int offset, String name) Some settings, like comment start and end strings, can vary between different parts of a buffer (HTML text and inline JavaScript, for example).int
getCurrentIndentForLine
(int lineIndex, int[] whitespaceChars) getDefaultProperty
(String key) int[]
getFoldAtLine
(int line) int
getFoldLevel
(int line) int
getIdealIndentForLine
(int lineIndex) int
int
getIntegerProperty
(String name, int defaultValue) getKeywordMapAtOffset
(int offset) int
getLineContext
(int line) Returns the line context of the token marker for the specified line.int
int
getLineEndOffset
(int line) Returns the end offset of the specified line.int
getLineLength
(int line) int
getLineOfOffset
(int offset) Returns the line containing the specified offset.getLineSegment
(int line) Returns the text on the specified line.int
getLineStartOffset
(int line) Returns the start offset of the specified line.getLineText
(int line) Returns the text on the specified line.void
getLineText
(int line, int relativeStartOffset, Segment segment) Returns the specified line from the starting point passed in relativeStartOffset in aSegment
.void
getLineText
(int line, Segment segment) Returns the specified line in aSegment
.getMode()
int
getOffsetOfVirtualColumn
(int line, int column, int[] totalVirtualWidth) Returns the offset of a virtual column number (taking tabs into account) relative to the start of the line in question.getPatternProperty
(String name, int flags) int
getPriorNonEmptyLine
(int lineIndex) Auto indent needs this.getProperty
(Object name) getRuleSetAtOffset
(int offset) getSegment
(int start, int length) Returns the specified text range.getStringProperty
(String name) int
int
getText()
getText
(int start, int length) void
Returns the specified text range in aSegment
.int
getVirtualWidth
(int line, int column) boolean
hasProperty
(Object name) boolean
indentLine
(int lineIndex, boolean canDecreaseIndent) Indents the specified line.void
indentLines
(int[] lines) Indents all specified lines.void
indentLines
(int start, int end) Indents all specified lines.void
void
insert
(int offset, CharSequence seq) Inserts a string into the buffer.void
Inserts a string into the buffer.void
Inserts a string into the buffer.void
insertAtColumn
(int line, int col, String str) Like theinsert(int,String)
method, but inserts the string at the specified virtual column.int
insertIndented
(int offset, String text) Inserts a string into the buffer, indenting each line of the string to match the indent of the first line.boolean
void
Invalidates all cached fold level information.protected void
boolean
Returns true if the buffer highlight is not sensitive to the context.boolean
isDirty()
boolean
boolean
isElectricKey
(char ch, int line) Should inserting this character trigger a re-indent of the current line?protected boolean
boolean
isFoldEnd
(int line) boolean
isFoldStart
(int line) boolean
boolean
boolean
boolean
boolean
protected void
loadText
(Segment seg, IntegerArray endOffsets) void
markTokens
(int lineIndex, TokenHandler tokenHandler) Returns the syntax tokens for the specified line.protected TokenMarker.LineContext
markTokens
(Segment seg, TokenMarker.LineContext prevContext, TokenHandler _tokenHandler) protected void
void
Reloads settings from the properties.void
readLock()
The buffer is guaranteed not to change between calls toreadLock()
andreadUnlock()
.void
The buffer is guaranteed not to change between calls toreadLock()
andreadUnlock()
.void
Redoes the most recently undone edit.void
remove
(int offset, int length) Removes the specified rang efrom the buffer.void
removeBufferListener
(BufferListener listener) Removes a buffer change listener.void
removeTrailingWhiteSpace
(int[] lines) Removes trailing whitespace from all lines in the specified list.void
void
setBooleanProperty
(String name, boolean value) Sets a boolean property.void
setContextInsensitive
(boolean contextInsensitive) Set the buffer to be insensitive to the context during highlight.void
setDefaultProperty
(String name, Object value) void
setDirty
(boolean d) void
setEditable
(boolean editable) protected void
setFileReadOnly
(boolean readOnly) void
setFoldHandler
(FoldHandler foldHandler) Sets the buffer's fold handler.void
setIntegerProperty
(String name, int value) Sets an integer property.void
setLoading
(boolean loading) void
Sets this buffer's edit mode.void
Sets this buffer's edit mode.void
Sets this buffer's edit mode.void
setPerformingIO
(boolean io) void
setProperty
(String name, Object value) Sets the value of a buffer-local property.void
setReadOnly
(boolean readOnly) Sets the read only flag.void
setStringProperty
(String name, String value) Sets a string property.void
setTokenMarker
(TokenMarker tokenMarker) void
setUndoLimit
(int limit) Set the undo limit of the Undo Manager.void
shiftIndentLeft
(int[] lines) Shifts the indent of each line in the specified list to the left.void
shiftIndentRight
(int[] lines) Shifts the indent of each line in the specified list to the right.void
simpleIndentLine
(int lineIndex) Simply indents the given line to the same level as the previous nonempty linevoid
Undoes the most recent edit.void
unsetProperty
(String name) Clears the value of a buffer-local property.void
updateColumnBlocks
(int startLine, int endLine, int startColumn, Node parent) void
Attempting to obtain read lock will block between calls towriteLock()
andwriteUnlock()
.void
Attempting to obtain read lock will block between calls towriteLock()
andwriteUnlock()
.
-
Field Details
-
LINESEP
Line separator property.- See Also:
-
ENCODING
Character encoding used when loading and saving.- Since:
- jEdit 3.2pre4
- See Also:
-
NORMAL_PRIORITY
public static final int NORMAL_PRIORITY- See Also:
-
HIGH_PRIORITY
public static final int HIGH_PRIORITY- See Also:
-
mode
The edit mode of the buffer. -
contextInsensitive
protected boolean contextInsensitiveIf true the syntax highlight is context insensitive. To highlight a line we don't keed the context of the previous line. -
undoMgr
-
tokenMarker
-
elasticTabstopsOn
public boolean elasticTabstopsOnThis field should be read instead of "elasticTabstops" property when efficiency matters. -
columnBlockLock
-
-
Constructor Details
-
JEditBuffer
-
JEditBuffer
public JEditBuffer()Create a new JEditBuffer. It is used by independent textarea only
-
-
Method Details
-
isDirty
public boolean isDirty()- Returns:
- whether there have been unsaved changes to this buffer. This method is thread-safe.
-
isLoading
public boolean isLoading() -
setLoading
public void setLoading(boolean loading) -
isPerformingIO
public boolean isPerformingIO()- Returns:
- true if the buffer is currently performing I/O. This method is thread-safe.
- Since:
- jEdit 2.7pre1
-
setPerformingIO
public void setPerformingIO(boolean io) - Parameters:
io
- true if the buffer is currently performing I/O. This method is thread-safe.- Since:
- jEdit 2.7pre1
-
isEditable
public boolean isEditable()- Returns:
- true if this file is editable, false otherwise. A file may become uneditable if it is read only, or if I/O is in progress. This method is thread-safe.
- Since:
- jEdit 2.7pre1
-
setEditable
public void setEditable(boolean editable) - Parameters:
editable
-true
to set the buffer editable,false
otherwise. Default istrue
. This does not change the read only flag on the file, just makes the buffer editable or not.
-
isReadOnly
public boolean isReadOnly()- Returns:
- true if this file is read only, false otherwise. This method is thread-safe.
-
setReadOnly
public void setReadOnly(boolean readOnly) Sets the read only flag.- Parameters:
readOnly
- The read only flag
-
setDirty
public void setDirty(boolean d) - Parameters:
d
- Sets the 'dirty' (changed since last save) flag of this buffer.
-
readLock
public void readLock()The buffer is guaranteed not to change between calls toreadLock()
andreadUnlock()
. Calls to this method may be nested. -
readUnlock
public void readUnlock()The buffer is guaranteed not to change between calls toreadLock()
andreadUnlock()
. -
writeLock
public void writeLock()Attempting to obtain read lock will block between calls towriteLock()
andwriteUnlock()
. Calls to this method may be nested. -
writeUnlock
public void writeUnlock()Attempting to obtain read lock will block between calls towriteLock()
andwriteUnlock()
. -
getLength
public int getLength()- Returns:
- the number of characters in the buffer. This method is thread-safe.
-
getLineCount
public int getLineCount()- Returns:
- the number of physical lines in the buffer. This method is thread-safe.
- Since:
- jEdit 3.1pre1
-
getLineOfOffset
public int getLineOfOffset(int offset) Returns the line containing the specified offset. This method is thread-safe.- Parameters:
offset
- The offset- Returns:
- the line of the offset
- Since:
- jEdit 4.0pre1
-
getLineStartOffset
public int getLineStartOffset(int line) Returns the start offset of the specified line. This method is thread-safe.- Parameters:
line
- The line- Returns:
- The start offset of the specified line, that is the offset after the end-of-line character before that line.
- Since:
- jEdit 4.0pre1
-
getLineEndOffset
public int getLineEndOffset(int line) Returns the end offset of the specified line. This method is thread-safe.- Parameters:
line
- The line- Returns:
- The end offset of the specified line, that is the offset
after the end-of-line character. Note that
buffer.getLineOfOffset(buffer.getLineEndOffset(x))
does not returnx
butx+1
. - Since:
- jEdit 4.0pre1
-
getLineLength
public int getLineLength(int line) - Parameters:
line
- The line- Returns:
- the length of the specified line. This method is thread-safe.
- Since:
- jEdit 4.0pre1
-
getPriorNonEmptyLine
public int getPriorNonEmptyLine(int lineIndex) Auto indent needs this.- Parameters:
lineIndex
- the line- Returns:
- the previous non-empty line
-
getLineText
Returns the text on the specified line. This method is thread-safe.- Parameters:
line
- The line- Returns:
- The text, or null if the line is invalid
- Since:
- jEdit 4.0pre1
-
getLineText
Returns the specified line in aSegment
.Using a
Segment
is generally more efficient than using aString
because it results in less memory allocation and array copying.This method is thread-safe.
- Parameters:
line
- The linesegment
- the segment- Since:
- jEdit 4.0pre1
-
getLineText
Returns the specified line from the starting point passed in relativeStartOffset in aSegment
.Using a
Segment
is generally more efficient than using aString
because it results in less memory allocation and array copying.This method is thread-safe.
- Parameters:
line
- The linesegment
- the segmentrelativeStartOffset
- the relative start offset- Since:
- jEdit 4.0pre1
-
getLineSegment
Returns the text on the specified line. This method is thread-safe.- Parameters:
line
- The line index.- Returns:
- The text, or null if the line is invalid
- Since:
- jEdit 4.3pre15
-
getText
- Parameters:
start
- The start offsetlength
- The number of characters to get- Returns:
- the specified text range. This method is thread-safe.
-
getText
- Returns:
- the full buffer content. This method is thread-safe
- Since:
- 4.4.1
-
getText
Returns the specified text range in aSegment
.Using a
Segment
is generally more efficient than using aString
because it results in less memory allocation and array copying.This method is thread-safe.
- Parameters:
start
- The start offsetlength
- The number of characters to getseg
- The segment to copy the text to
-
getSegment
Returns the specified text range. This method is thread-safe. It doesn't copy the text- Parameters:
start
- The start offsetlength
- The number of characters to get- Returns:
- a CharSequence that contains the text wanted text
- Since:
- jEdit 4.3pre15
-
insert
Inserts a string into the buffer.- Parameters:
offset
- The offsetstr
- The string- Since:
- jEdit 4.0pre1
-
insert
Inserts a string into the buffer.- Parameters:
offset
- The offsetseg
- The segment- Since:
- jEdit 4.0pre1
-
insert
Inserts a string into the buffer.- Parameters:
offset
- The offsetseq
- The charsequence- Since:
- jEdit 5.0pre1
-
remove
public void remove(int offset, int length) Removes the specified rang efrom the buffer.- Parameters:
offset
- The start offsetlength
- The number of characters to remove
-
removeTrailingWhiteSpace
public void removeTrailingWhiteSpace(int[] lines) Removes trailing whitespace from all lines in the specified list.- Parameters:
lines
- The line numbers- Since:
- jEdit 3.2pre1
-
shiftIndentLeft
public void shiftIndentLeft(int[] lines) Shifts the indent of each line in the specified list to the left.- Parameters:
lines
- The line numbers- Since:
- jEdit 3.2pre1
-
shiftIndentRight
public void shiftIndentRight(int[] lines) Shifts the indent of each line in the specified list to the right.- Parameters:
lines
- The line numbers- Since:
- jEdit 3.2pre1
-
indentLines
public void indentLines(int start, int end) Indents all specified lines.- Parameters:
start
- The first line to indentend
- The last line to indent- Since:
- jEdit 3.1pre3
-
indentLines
public void indentLines(int[] lines) Indents all specified lines.- Parameters:
lines
- The line numbers- Since:
- jEdit 3.2pre1
-
simpleIndentLine
public void simpleIndentLine(int lineIndex) Simply indents the given line to the same level as the previous nonempty line- Parameters:
lineIndex
- The line number to indent- Since:
- jEdit 5.0
-
indentLine
public boolean indentLine(int lineIndex, boolean canDecreaseIndent) Indents the specified line.- Parameters:
lineIndex
- The line number to indentcanDecreaseIndent
- If true, the indent can be decreased as a result of this. Set this to false for Tab key.- Returns:
- true If indentation took place, false otherwise.
- Since:
- jEdit 4.2pre2
-
getCurrentIndentForLine
public int getCurrentIndentForLine(int lineIndex, int[] whitespaceChars) - Parameters:
lineIndex
- The line numberwhitespaceChars
- If this is non-null, the number of whitespace characters is stored at the 0 index- Returns:
- the line's current leading indent.
- Since:
- jEdit 4.2pre2
-
getIdealIndentForLine
public int getIdealIndentForLine(int lineIndex) - Parameters:
lineIndex
- The line number- Returns:
- the ideal leading indent for the specified line. This will apply the various auto-indent rules.
-
getVirtualWidth
public int getVirtualWidth(int line, int column) - Parameters:
line
- The line numbercolumn
- The column number- Returns:
- the virtual column number (taking tabs into account) of the specified position.
- Since:
- jEdit 4.1pre1
-
getOffsetOfVirtualColumn
public int getOffsetOfVirtualColumn(int line, int column, int[] totalVirtualWidth) Returns the offset of a virtual column number (taking tabs into account) relative to the start of the line in question.- Parameters:
line
- The line numbercolumn
- The virtual column numbertotalVirtualWidth
- If this array is non-null, the total virtual width will be stored in its first location if this method returns -1.- Returns:
- -1 if the column is out of bounds
- Since:
- jEdit 4.1pre1
-
insertAtColumn
Like theinsert(int,String)
method, but inserts the string at the specified virtual column. Inserts spaces as appropriate if the line is shorter than the column.- Parameters:
line
- The line numbercol
- The virtual column numberstr
- The string
-
insertIndented
Inserts a string into the buffer, indenting each line of the string to match the indent of the first line.- Parameters:
offset
- The offsettext
- The text- Returns:
- The number of characters of indent inserted on each new line. This is used by the abbreviations code.
- Since:
- jEdit 4.2pre14
-
isElectricKey
public boolean isElectricKey(char ch, int line) Should inserting this character trigger a re-indent of the current line?- Parameters:
ch
- a characterline
- the line- Returns:
- true if is electric key
- Since:
- jEdit 4.3pre9
-
getLineContext
Returns the line context of the token marker for the specified line. -
markTokens
Returns the syntax tokens for the specified line.- Parameters:
lineIndex
- The line numbertokenHandler
- The token handler that will receive the syntax tokens- Since:
- jEdit 4.1pre1
-
getTokenMarker
-
setTokenMarker
-
createPosition
Creates a floating position (javax.swing.text.Position
). The position is retained despite text editions.No explicit removal of position is necessary, only dereferencing it.
- Parameters:
offset
- The offset- Returns:
- the position
-
propertiesChanged
public void propertiesChanged()Reloads settings from the properties. This should be called after thesyntax
orfolding
buffer-local properties are changed. -
getTabSize
public int getTabSize()- Returns:
- the tab size used in this buffer. This is equivalent
to calling
getProperty("tabSize")
. This method is thread-safe.
-
getIndentSize
public int getIndentSize()- Returns:
- the indent size used in this buffer. This is equivalent
to calling
getProperty("indentSize")
. This method is thread-safe. - Since:
- jEdit 2.7pre1
-
getProperty
- Parameters:
name
- The property name. For backwards compatibility, this is anObject
, not aString
.- Returns:
- the value of a buffer-local property.
Using this method is generally discouraged, because it returns an
Object
which must be cast to another type in order to be useful, and this can cause problems if the object is of a different type than what the caller expects.The following methods should be used instead:
This method is thread-safe.
-
hasProperty
- Parameters:
name
- The property name. For backwards compatibility, this is anObject
, not aString
.- Returns:
- true if the buffer local property exists. This method is thread-safe.
- Since:
- jEdit 5.6pre1
-
getDefaultProperty
-
setProperty
Sets the value of a buffer-local property.- Parameters:
name
- The property namevalue
- The property value- Since:
- jEdit 4.0pre1
-
setDefaultProperty
-
unsetProperty
Clears the value of a buffer-local property.- Parameters:
name
- The property name- Since:
- jEdit 4.0pre1
-
resetCachedProperties
public void resetCachedProperties() -
getStringProperty
- Parameters:
name
- The property name- Returns:
- the value of a string property. This method is thread-safe.
- Since:
- jEdit 4.0pre1
-
setStringProperty
Sets a string property.- Parameters:
name
- The property namevalue
- The value- Since:
- jEdit 4.0pre1
-
getBooleanProperty
- Parameters:
name
- The property name- Returns:
- the value of a boolean property. This method is thread-safe.
- Since:
- jEdit 4.0pre1
-
getBooleanProperty
- Parameters:
name
- The property namedef
- The default value- Returns:
- the value of a boolean property. This method is thread-safe.
- Since:
- jEdit 4.3pre17
-
setBooleanProperty
Sets a boolean property.- Parameters:
name
- The property namevalue
- The value- Since:
- jEdit 4.0pre1
-
getIntegerProperty
- Parameters:
name
- The property namedefaultValue
- the default value to use- Returns:
- the value of an integer property. This method is thread-safe.
- Since:
- jEdit 4.0pre1
-
setIntegerProperty
Sets an integer property.- Parameters:
name
- The property namevalue
- The value- Since:
- jEdit 4.0pre1
-
getPatternProperty
- Parameters:
name
- The property nameflags
- Regular expression compilation flags- Returns:
- the value of a property as a regular expression. This method is thread-safe.
- Since:
- jEdit 4.3pre5
-
getRuleSetAtOffset
- Parameters:
offset
- the offset- Returns:
- the syntax highlighting ruleset at the specified offset.
- Since:
- jEdit 4.1pre1
-
getKeywordMapAtOffset
- Parameters:
offset
- The offset- Returns:
- the syntax highlighting keyword map in effect at the specified offset. Used by the Complete Word command to complete keywords.
- Since:
- jEdit 4.0pre3
-
getContextSensitiveProperty
Some settings, like comment start and end strings, can vary between different parts of a buffer (HTML text and inline JavaScript, for example).- Parameters:
offset
- The offsetname
- The property name- Returns:
- the property value
- Since:
- jEdit 4.0pre3
-
getMode
- Returns:
- this buffer's edit mode. This method is thread-safe.
-
setMode
Sets this buffer's edit mode. Note that calling this before a buffer is loaded will have no effect; in that case, set the "mode" property to the name of the mode. A bit inelegant, I know...- Parameters:
mode
- The mode name- Since:
- jEdit 4.2pre1
-
setMode
Sets this buffer's edit mode. Note that calling this before a buffer is loaded will have no effect; in that case, set the "mode" property to the name of the mode. A bit inelegant, I know...- Parameters:
mode
- The mode
-
setMode
Sets this buffer's edit mode. Note that calling this before a buffer is loaded will have no effect; in that case, set the "mode" property to the name of the mode. A bit inelegant, I know...- Parameters:
mode
- The modeforceContextInsensitive
- true if you want to force the buffer to be insensitive to the context. Careful it can break syntax highlight. Default value is false- Since:
- jEdit 4.5pre1
-
isFoldStart
public boolean isFoldStart(int line) - Parameters:
line
- the line- Returns:
- if the specified line begins a fold.
- Since:
- jEdit 3.1pre1
-
isFoldEnd
public boolean isFoldEnd(int line) - Parameters:
line
- the line- Returns:
- if the specified line ends a fold.
- Since:
- jEdit 4.2pre5
-
invalidateCachedFoldLevels
public void invalidateCachedFoldLevels()Invalidates all cached fold level information.- Since:
- jEdit 4.1pre11
-
getFoldLevel
public int getFoldLevel(int line) - Parameters:
line
- A physical line index- Returns:
- the fold level of the specified line.
- Since:
- jEdit 3.1pre1
-
getFoldAtLine
public int[] getFoldAtLine(int line) - Parameters:
line
- The line number- Returns:
- an array. The first element is the start line, the second element is the end line, of the fold containing the specified line number.
- Since:
- jEdit 4.0pre3
-
getFoldHandler
- Returns:
- the current buffer's fold handler.
- Since:
- jEdit 4.2pre1
-
setFoldHandler
Sets the buffer's fold handler.- Parameters:
foldHandler
- the fold handler- Since:
- jEdit 4.2pre2
-
undo
Undoes the most recent edit.- Parameters:
textArea
- the text area- Since:
- jEdit 4.0pre1
-
redo
Redoes the most recently undone edit.- Parameters:
textArea
- the textArea- Since:
- jEdit 2.7pre2
-
isTransactionInProgress
public boolean isTransactionInProgress()- Returns:
- if an undo or compound edit is currently in progress. If this
method returns true, then eventually a
BufferListener.transactionComplete(JEditBuffer)
buffer event will get fired. - Since:
- jEdit 4.0pre6
-
beginCompoundEdit
public void beginCompoundEdit()Starts a compound edit. All edits from now on untilendCompoundEdit()
are called will be merged into one. This can be used to make a complex operation undoable in one step. Nested calls tobeginCompoundEdit()
behave as expected, requiring the same number ofendCompoundEdit()
calls to end the edit.- See Also:
-
endCompoundEdit
public void endCompoundEdit()Ends a compound edit. All edits performed sincebeginCompoundEdit()
was called can now be undone in one step by callingundo(TextArea)
.- See Also:
-
insideCompoundEdit
public boolean insideCompoundEdit()- Returns:
- if a compound edit is currently active.
- Since:
- jEdit 3.1pre1
-
isUndoInProgress
public boolean isUndoInProgress()- Returns:
- if an undo or redo is currently being performed.
- Since:
- jEdit 4.3pre3
-
getUndoId
- Returns:
- an object that identifies the undo operation to which the current content change belongs. This method can be used by buffer listeners during content changes (contentInserted/contentRemoved) to find out which content changes belong to the same "undo" operation. The same undoId object will be returned for all content changes belonging to the same undo operation. Only the identity of the undoId can be used, by comparing it with a previously-returned undoId using "==".
- Since:
- jEdit 4.3pre18
-
addBufferListener
Adds a buffer change listener.- Parameters:
listener
- The listenerpriority
- Listeners with HIGH_PRIORITY get the event before listeners with NORMAL_PRIORITY- Since:
- jEdit 4.3pre3
-
addBufferListener
Adds a buffer change listener.- Parameters:
listener
- The listener- Since:
- jEdit 4.3pre3
-
removeBufferListener
Removes a buffer change listener.- Parameters:
listener
- The listener- Since:
- jEdit 4.3pre3
-
getBufferListeners
- Returns:
- an array of registered buffer change listeners.
- Since:
- jEdit 4.3pre3
-
setUndoLimit
public void setUndoLimit(int limit) Set the undo limit of the Undo Manager.- Parameters:
limit
- the new limit- Since:
- jEdit 4.3pre16
-
canUndo
public boolean canUndo()- Returns:
- true if an undo operation can be performed.
- Since:
- jEdit 4.3pre18
-
canRedo
public boolean canRedo()- Returns:
- true if a redo operation can be performed.
- Since:
- jEdit 4.3pre18
-
isContextInsensitive
public boolean isContextInsensitive()Returns true if the buffer highlight is not sensitive to the context.- Returns:
- true if the highlight is insensitive to the context
- Since:
- jEdit 4.5pre1
-
setContextInsensitive
public void setContextInsensitive(boolean contextInsensitive) Set the buffer to be insensitive to the context during highlight.- Parameters:
contextInsensitive
- the new contextInsensitive value the context- Since:
- jEdit 4.5pre1
-
fireFoldLevelChanged
protected void fireFoldLevelChanged(int start, int end) -
fireContentInserted
protected void fireContentInserted(int startLine, int offset, int numLines, int length) -
fireContentRemoved
protected void fireContentRemoved(int startLine, int offset, int numLines, int length) -
firePreContentInserted
protected void firePreContentInserted(int startLine, int offset, int numLines, int length) -
firePreContentRemoved
protected void firePreContentRemoved(int startLine, int offset, int numLines, int length) -
fireBeginUndo
protected void fireBeginUndo() -
fireEndUndo
protected void fireEndUndo() -
fireBeginRedo
protected void fireBeginRedo() -
fireEndRedo
protected void fireEndRedo() -
fireTransactionComplete
protected void fireTransactionComplete() -
fireFoldHandlerChanged
protected void fireFoldHandlerChanged() -
fireBufferLoaded
protected void fireBufferLoaded() -
isFileReadOnly
protected boolean isFileReadOnly() -
setFileReadOnly
protected void setFileReadOnly(boolean readOnly) -
loadText
-
invalidateFoldLevels
protected void invalidateFoldLevels() -
parseBufferLocalProperties
protected void parseBufferLocalProperties() -
markTokens
protected TokenMarker.LineContext markTokens(Segment seg, TokenMarker.LineContext prevContext, TokenHandler _tokenHandler) -
updateColumnBlocks
-
getTabStopPosition
-
indentUsingElasticTabstops
public void indentUsingElasticTabstops() -
getColumnBlock
-