|
|||||||||
| Home >> All >> org >> gjt >> sp >> [ jedit overview ] | PREV CLASS NEXT CLASS | ||||||||
SUMMARY: JAVADOC | SOURCE | DOWNLOAD | NESTED | FIELD | CONSTR | METHOD |
DETAIL: FIELD | CONSTR | METHOD | ||||||||
org.gjt.sp.jedit
Class Buffer

java.lang.Objectorg.gjt.sp.jedit.Buffer
- public class Buffer
- extends java.lang.Object
A Buffer 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).
In a BeanShell script, you can obtain the current buffer instance from the
buffer variable.
This class does not have a public constructor.
Buffers can be opened and closed using methods in the jEdit
class.
This class is partially thread-safe, however you must pay attention to two very important guidelines:
- Changes to a buffer can only be made from the AWT thread.
- When accessing the buffer from another thread, you must grab a read lock if you plan on performing more than one call, 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.
- Version:
- $Id: Buffer.java,v 1.208 2003/11/22 20:32:28 spestov Exp $
| Nested Class Summary | |
(package private) static class |
Buffer.Listener
|
(package private) static class |
Buffer.PropValue
|
static class |
Buffer.TokenList
Deprecated. Use org.gjt.sp.jedit.syntax.DefaultTokenHandler instead |
| Field Summary | |
private static int |
AUTOSAVE_DIRTY
|
private java.io.File |
autosaveFile
|
static java.lang.String |
BACKED_UP
Backed up property. |
private java.util.Vector |
bufferListeners
|
static java.lang.String |
CARET
Caret info properties. |
private static int |
CLOSED
|
private org.gjt.sp.jedit.buffer.ContentManager |
contentMgr
|
private java.lang.String |
directory
|
private static int |
DIRTY
|
static java.lang.String |
ENCODING
Character encoding used when loading and saving. |
static java.lang.String |
ENCODING_AUTODETECT
Should jEdit try to set the encoding based on a UTF8, UTF16 or XML signature at the beginning of the file? |
private java.io.File |
file
|
static int |
FILE_CHANGED
|
static int |
FILE_DELETED
|
static int |
FILE_NOT_CHANGED
|
private int |
flags
|
private org.gjt.sp.jedit.buffer.FoldHandler |
foldHandler
|
static java.lang.String |
GZIPPED
This property is set to 'true' if the file should be GZipped. |
static int |
HIGH_PRIORITY
|
private org.gjt.sp.util.IntegerArray |
integerArray
|
private static int |
IO
|
private org.gjt.sp.jedit.buffer.LineManager |
lineMgr
|
static java.lang.String |
LINESEP
Line separator property. |
private static int |
LOADING
|
private org.gjt.sp.util.ReadWriteLock |
lock
|
private java.util.Vector |
markers
|
private Mode |
mode
|
private long |
modTime
|
private java.lang.String |
name
|
private static int |
NEW_FILE
|
(package private) Buffer |
next
|
static int |
NORMAL_PRIORITY
|
private java.lang.String |
path
|
private org.gjt.sp.jedit.buffer.PositionManager |
positionMgr
|
(package private) Buffer |
prev
|
private java.util.HashMap |
properties
|
private java.lang.Object |
propertyLock
|
private static int |
READ_ONLY
|
private static int |
READ_ONLY_OVERRIDE
|
static java.lang.String |
SCROLL_HORIZ
|
static java.lang.String |
SCROLL_VERT
This should be a physical line number, so that the scroll position is preserved correctly across reloads (which will affect virtual line numbers, due to fold being reset) |
private javax.swing.text.Segment |
seg
|
static java.lang.String |
SELECTION
|
private java.lang.String |
symlinkPath
|
private static int |
TEMPORARY
|
private boolean |
textMode
|
private org.gjt.sp.jedit.syntax.TokenMarker |
tokenMarker
|
static java.lang.String |
TRAILING_EOL
This property is set to 'true' if the file has a trailing newline. |
private static int |
TRANSACTION
|
private static int |
UNDO_IN_PROGRESS
|
private org.gjt.sp.jedit.buffer.UndoManager |
undoMgr
|
private static int |
UNTITLED
|
private java.net.Socket |
waitSocket
|
| Constructor Summary | |
(package private) |
Buffer(java.lang.String path,
boolean newFile,
boolean temp,
java.util.Hashtable props)
|
| Method Summary | |
org.gjt.sp.jedit.buffer.LineManager |
_getLineManager()
Plugins and macros should not call this method. |
void |
addBufferChangeListener(org.gjt.sp.jedit.buffer.BufferChangeListener listener)
Adds a buffer change listener. |
void |
addBufferChangeListener(org.gjt.sp.jedit.buffer.BufferChangeListener listener,
int priority)
Adds a buffer change listener. |
void |
addMarker(char shortcut,
int pos)
Adds a marker to this buffer. |
void |
addOrRemoveMarker(char shortcut,
int pos)
If a marker is set on the line of the position, it is removed. |
void |
autosave()
Autosaves this buffer. |
void |
beginCompoundEdit()
Starts a compound edit. |
private boolean |
checkFileForLoad(View view,
org.gjt.sp.jedit.io.VFS vfs,
java.lang.String path)
|
private boolean |
checkFileForSave(View view,
org.gjt.sp.jedit.io.VFS vfs,
java.lang.String path)
|
int |
checkFileStatus(View view)
Check if the buffer has changed on disk. |
(package private) void |
close()
|
(package private) void |
commitTemporary()
|
private void |
contentInserted(int offset,
int length,
org.gjt.sp.util.IntegerArray endOffsets)
|
javax.swing.text.Position |
createPosition(int offset)
Creates a floating position. |
void |
endCompoundEdit()
Ends a compound edit. |
private void |
finishLoading()
|
private void |
finishSaving(View view,
java.lang.String oldPath,
java.lang.String oldSymlinkPath,
java.lang.String path,
boolean rename,
boolean error)
|
private void |
fireContentInserted(int startLine,
int offset,
int numLines,
int length)
|
private void |
fireContentRemoved(int startLine,
int offset,
int numLines,
int length)
|
private void |
fireFoldHandlerChanged()
|
private void |
fireFoldLevelChanged(int start,
int end)
|
private void |
firePreContentRemoved(int startLine,
int offset,
int numLines,
int length)
|
private void |
fireTransactionComplete()
|
java.io.File |
getAutosaveFile()
Returns the autosave file for this buffer. |
boolean |
getBooleanProperty(java.lang.String name)
Returns the value of a boolean property. |
org.gjt.sp.jedit.buffer.BufferChangeListener[] |
getBufferChangeListeners()
Returns an array of registered buffer change listeners. |
java.lang.String |
getContextSensitiveProperty(int offset,
java.lang.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 |
getCurrentIdentForLine(int lineIndex,
int[] whitespaceChars)
Returns the line's current leading indent. |
javax.swing.text.Element |
getDefaultRootElement()
Deprecated. Use getLineOfOffset(),
getLineStartOffset(), and
getLineEndOffset() instead. |
java.lang.String |
getDirectory()
Returns the directory containing this buffer. |
java.io.File |
getFile()
Deprecated. Do not call this method, use getPath() 55
instead. |
private boolean |
getFlag(int flag)
|
int[] |
getFoldAtLine(int line)
Returns an array. |
org.gjt.sp.jedit.buffer.FoldHandler |
getFoldHandler()
Returns the current buffer's fold handler. |
int |
getFoldLevel(int line)
Returns the fold level of the specified line. |
javax.swing.Icon |
getIcon()
Returns this buffer's icon. |
int |
getIdealIndentForLine(int lineIndex)
Returns the ideal leading indent for the specified line. |
int |
getIndentSize()
Returns the indent size used in this buffer. |
int |
getIndex()
Returns the position of this buffer in the buffer list. |
int |
getIntegerProperty(java.lang.String name,
int defaultValue)
Returns the value of an integer property. |
org.gjt.sp.jedit.syntax.KeywordMap |
getKeywordMapAtOffset(int offset)
Returns the syntax highlighting keyword map in effect at the specified offset. |
long |
getLastModified()
Returns the last time jEdit modified the file on disk. |
int |
getLength()
Returns the number of characters in the buffer. |
int |
getLineCount()
Returns the number of physical lines in the buffer. |
int |
getLineEndOffset(int line)
Returns the end offset of the specified line. |
int |
getLineLength(int line)
Returns the length of the specified line. |
int |
getLineOfOffset(int offset)
Returns the line containing the specified offset. |
int |
getLineStartOffset(int line)
Returns the start offset of the specified line. |
java.lang.String |
getLineText(int line)
Returns the text on the specified line. |
void |
getLineText(int line,
javax.swing.text.Segment segment)
Returns the specified line in a Segment. |
private org.gjt.sp.jedit.buffer.BufferChangeListener |
getListener(int index)
|
Marker |
getMarker(char shortcut)
Returns the marker with the specified shortcut. |
Marker |
getMarkerAtLine(int line)
Returns the first marker at the specified line, or null
if there is none. |
Marker |
getMarkerInRange(int start,
int end)
Returns the first marker within the specified range. |
java.lang.String |
getMarkerNameString()
Returns a string of all set markers, used by the status bar (eg, "a b $ % ^"). |
java.util.Vector |
getMarkers()
Returns a vector of markers. |
java.lang.String |
getMarkerStatusPrompt(java.lang.String action)
Returns the status prompt for the given marker action. |
Mode |
getMode()
Returns this buffer's edit mode. |
java.lang.String |
getName()
Returns the name of this buffer. |
Buffer |
getNext()
Returns the next buffer in the list. |
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. |
javax.swing.text.Element |
getParagraphElement(int offset)
Deprecated. |
java.lang.String |
getPath()
Returns the path name of this buffer. |
Buffer |
getPrev()
Returns the previous buffer in the list. |
private int |
getPriorNonEmptyLine(int lineIndex)
Auto indent needs this. |
java.lang.Object |
getProperty(java.lang.Object name)
Returns the value of a buffer-local property. |
gnu.regexp.RE |
getRegexpProperty(java.lang.String name,
int cflags,
gnu.regexp.RESyntax syntax)
Returns the value of a property as a regular expression. |
javax.swing.text.Element[] |
getRootElements()
Deprecated. |
org.gjt.sp.jedit.syntax.ParserRuleSet |
getRuleSetAtOffset(int offset)
Returns the syntax highlighting ruleset at the specified offset. |
java.lang.String |
getStringProperty(java.lang.String name)
Returns the value of a string property. |
java.lang.String |
getSymlinkPath()
If this file is a symbolic link, returns the link destination. |
int |
getTabSize()
Returns the tab size used in this buffer. |
java.lang.String |
getText(int start,
int length)
Returns the specified text range. |
void |
getText(int start,
int length,
javax.swing.text.Segment seg)
Returns the specified text range in a Segment. |
org.gjt.sp.jedit.io.VFS |
getVFS()
Returns the virtual filesystem responsible for loading and saving this buffer. |
int |
getVirtualWidth(int line,
int column)
Returns the virtual column number (taking tabs into account) of the specified position. |
boolean |
indentLine(int lineIndex,
boolean canDecreaseIndent)
Indents the specified line. |
boolean |
indentLine(int lineIndex,
boolean canIncreaseIndent,
boolean canDecreaseIndent)
Deprecated. Use indentLine(int,boolean) 55 instead. |
void |
indentLines(int[] lines)
Indents all specified lines. |
void |
indentLines(int start,
int end)
Indents all specified lines. |
void |
insert(int offset,
javax.swing.text.Segment seg)
Inserts a string into the buffer. |
void |
insert(int offset,
java.lang.String str)
Inserts a string into the buffer. |
void |
insertAtColumn(int line,
int col,
java.lang.String str)
Like the insert(int,String) 55 method, but inserts the string at
the specified virtual column. |
boolean |
insertFile(View view,
java.lang.String path)
Loads a file from disk, and inserts it into this buffer. |
void |
insertString(int offset,
java.lang.String str,
javax.swing.text.AttributeSet attr)
Deprecated. Call insert() instead. |
boolean |
insideCompoundEdit()
Returns if a compound edit is currently active. |
void |
invalidateCachedFoldLevels()
Invalidates all cached fold level information. |
void |
invalidateCachedScreenLineCounts()
Invalidates all cached screen line count information. |
boolean |
isClosed()
Returns true if this buffer has been closed with jEdit.closeBuffer(View,Buffer) 55 . |
boolean |
isDirty()
Returns whether there have been unsaved changes to this buffer. |
boolean |
isEditable()
Returns true if this file is editable, false otherwise. |
boolean |
isFoldEnd(int line)
Returns if the specified line ends a fold. |
boolean |
isFoldStart(int line)
Returns if the specified line begins a fold. |
boolean |
isLoaded()
Returns true if the buffer is loaded. |
boolean |
isNewFile()
Returns whether this buffer lacks a corresponding version on disk. |
boolean |
isPerformingIO()
Returns true if the buffer is currently performing I/O. |
boolean |
isReadOnly()
Returns true if this file is read only, false otherwise. |
boolean |
isTemporary()
Returns if this is a temporary buffer. |
boolean |
isTransactionInProgress()
Returns if an undo or compound edit is currently in progress. |
boolean |
isUntitled()
Returns true if this file is 'untitled'. |
boolean |
load(View view,
boolean reload)
Loads the buffer from disk, even if it is loaded already. |
Buffer.TokenList |
markTokens(int lineIndex)
Deprecated. Use the other form of markTokens() instead |
void |
markTokens(int lineIndex,
org.gjt.sp.jedit.syntax.TokenHandler tokenHandler)
Returns the syntax tokens for the specified line. |
private void |
parseBufferLocalProperties()
|
private void |
parseBufferLocalProperties(java.lang.String prop)
|
void |
propertiesChanged()
Reloads settings from the properties. |
void |
putBooleanProperty(java.lang.String name,
boolean value)
Deprecated. Call setBooleanProperty() instead |
void |
putProperty(java.lang.Object name,
java.lang.Object value)
Deprecated. Call setProperty() instead. |
void |
readLock()
The buffer is guaranteed not to change between calls to readLock() 55 and readUnlock() 55 . |
void |
readUnlock()
The buffer is guaranteed not to change between calls to readLock() 55 and readUnlock() 55 . |
private boolean |
recoverAutosave(View view)
|
void |
redo(org.gjt.sp.jedit.textarea.JEditTextArea textArea)
Redoes the most recently undone edit. |
void |
reload(View view)
Reloads the buffer from disk, asking for confirmation if the buffer has unsaved changes. |
void |
remove(int offset,
int length)
Removes the specified rang efrom the buffer. |
void |
removeAllMarkers()
Removes all defined markers. |
void |
removeBufferChangeListener(org.gjt.sp.jedit.buffer.BufferChangeListener listener)
Removes a buffer change listener. |
void |
removeMarker(int line)
Removes all markers at the specified line. |
void |
removeTrailingWhiteSpace(int[] lines)
Removes trailing whitespace from all lines in the specified list. |
(package private) void |
resetCachedProperties()
|
boolean |
save(View view,
java.lang.String path)
Saves this buffer to the specified path name, or the current path name if it's null. |
boolean |
save(View view,
java.lang.String path,
boolean rename)
Saves this buffer to the specified path name, or the current path name if it's null. |
boolean |
saveAs(View view,
boolean rename)
Prompts the user for a file to save this buffer to. |
void |
setBooleanProperty(java.lang.String name,
boolean value)
Sets a boolean property. |
void |
setDirty(boolean d)
Sets the 'dirty' (changed since last save) flag of this buffer. |
private void |
setFlag(int flag,
boolean value)
|
void |
setFoldHandler(org.gjt.sp.jedit.buffer.FoldHandler foldHandler)
Sets the buffer's fold handler. |
void |
setIntegerProperty(java.lang.String name,
int value)
Sets an integer property. |
void |
setLastModified(long modTime)
Sets the last time jEdit modified the file on disk. |
void |
setMode()
Sets this buffer's edit mode by calling the accept() method of each registered edit mode. |
void |
setMode(Mode mode)
Sets this buffer's edit mode. |
void |
setMode(java.lang.String mode)
Sets this buffer's edit mode. |
void |
setNewFile(boolean newFile)
Sets the new file flag. |
private void |
setPath(java.lang.String path)
|
void |
setProperty(java.lang.String name,
java.lang.Object value)
Sets the value of a buffer-local property. |
void |
setReadOnly(boolean readOnly)
Sets the read only flag. |
void |
setStringProperty(java.lang.String name,
java.lang.String value)
Sets a string property. |
private void |
setTokenMarker(org.gjt.sp.jedit.syntax.TokenMarker tokenMarker)
|
void |
setWaitSocket(java.net.Socket waitSocket)
This socket is closed when the buffer is closed. |
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 |
toggleLineSeparator(View view)
Toggles the line separator between the three available settings. |
void |
toggleWordWrap(View view)
Toggles word wrap between the three available modes. |
java.lang.String |
toString()
Returns a string representation of this buffer. |
void |
undo(org.gjt.sp.jedit.textarea.JEditTextArea textArea)
Undoes the most recent edit. |
void |
unsetProperty(java.lang.String name)
Clears the value of a buffer-local property. |
void |
writeLock()
Attempting to obtain read lock will block between calls to writeLock() 55 and writeUnlock() 55 . |
void |
writeUnlock()
Attempting to obtain read lock will block between calls to writeLock() 55 and writeUnlock() 55 . |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
LINESEP
public static final java.lang.String LINESEP
- Line separator property.
- See Also:
- Constant Field Values
BACKED_UP
public static final java.lang.String BACKED_UP
- Backed up property.
- Since:
- jEdit 3.2pre2
- See Also:
- Constant Field Values
CARET
public static final java.lang.String CARET
- Caret info properties.
- Since:
- jEdit 3.2pre1
- See Also:
- Constant Field Values
SELECTION
public static final java.lang.String SELECTION
- See Also:
- Constant Field Values
SCROLL_VERT
public static final java.lang.String SCROLL_VERT
- This should be a physical line number, so that the scroll
position is preserved correctly across reloads (which will
affect virtual line numbers, due to fold being reset)
- See Also:
- Constant Field Values
SCROLL_HORIZ
public static final java.lang.String SCROLL_HORIZ
- See Also:
- Constant Field Values
ENCODING
public static final java.lang.String ENCODING
- Character encoding used when loading and saving.
- Since:
- jEdit 3.2pre4
- See Also:
- Constant Field Values
ENCODING_AUTODETECT
public static final java.lang.String ENCODING_AUTODETECT
- Should jEdit try to set the encoding based on a UTF8, UTF16 or
XML signature at the beginning of the file?
- See Also:
- Constant Field Values
TRAILING_EOL
public static final java.lang.String TRAILING_EOL
- This property is set to 'true' if the file has a trailing newline.
- Since:
- jEdit 4.0pre1
- See Also:
- Constant Field Values
GZIPPED
public static final java.lang.String GZIPPED
- This property is set to 'true' if the file should be GZipped.
- Since:
- jEdit 4.0pre4
- See Also:
- Constant Field Values
FILE_NOT_CHANGED
public static final int FILE_NOT_CHANGED
- See Also:
- Constant Field Values
FILE_CHANGED
public static final int FILE_CHANGED
- See Also:
- Constant Field Values
FILE_DELETED
public static final int FILE_DELETED
- See Also:
- Constant Field Values
NORMAL_PRIORITY
public static final int NORMAL_PRIORITY
- See Also:
- Constant Field Values
HIGH_PRIORITY
public static final int HIGH_PRIORITY
- See Also:
- Constant Field Values
prev
Buffer prev
next
Buffer next
CLOSED
private static final int CLOSED
- See Also:
- Constant Field Values
LOADING
private static final int LOADING
- See Also:
- Constant Field Values
IO
private static final int IO
- See Also:
- Constant Field Values
NEW_FILE
private static final int NEW_FILE
- See Also:
- Constant Field Values
UNTITLED
private static final int UNTITLED
- See Also:
- Constant Field Values
AUTOSAVE_DIRTY
private static final int AUTOSAVE_DIRTY
- See Also:
- Constant Field Values
DIRTY
private static final int DIRTY
- See Also:
- Constant Field Values
READ_ONLY
private static final int READ_ONLY
- See Also:
- Constant Field Values
READ_ONLY_OVERRIDE
private static final int READ_ONLY_OVERRIDE
- See Also:
- Constant Field Values
UNDO_IN_PROGRESS
private static final int UNDO_IN_PROGRESS
- See Also:
- Constant Field Values
TEMPORARY
private static final int TEMPORARY
- See Also:
- Constant Field Values
TRANSACTION
private static final int TRANSACTION
- See Also:
- Constant Field Values
flags
private int flags
path
private java.lang.String path
symlinkPath
private java.lang.String symlinkPath
name
private java.lang.String name
directory
private java.lang.String directory
file
private java.io.File file
autosaveFile
private java.io.File autosaveFile
modTime
private long modTime
mode
private Mode mode
properties
private java.util.HashMap properties
lock
private org.gjt.sp.util.ReadWriteLock lock
propertyLock
private java.lang.Object propertyLock
contentMgr
private org.gjt.sp.jedit.buffer.ContentManager contentMgr
lineMgr
private org.gjt.sp.jedit.buffer.LineManager lineMgr
positionMgr
private org.gjt.sp.jedit.buffer.PositionManager positionMgr
integerArray
private org.gjt.sp.util.IntegerArray integerArray
undoMgr
private org.gjt.sp.jedit.buffer.UndoManager undoMgr
bufferListeners
private java.util.Vector bufferListeners
markers
private java.util.Vector markers
textMode
private boolean textMode
tokenMarker
private org.gjt.sp.jedit.syntax.TokenMarker tokenMarker
seg
private javax.swing.text.Segment seg
foldHandler
private org.gjt.sp.jedit.buffer.FoldHandler foldHandler
waitSocket
private java.net.Socket waitSocket
| Constructor Detail |
Buffer
Buffer(java.lang.String path, boolean newFile, boolean temp, java.util.Hashtable props)
| Method Detail |
reload
public void reload(View view)
- Reloads the buffer from disk, asking for confirmation if the buffer
has unsaved changes.
- Since:
- jEdit 2.7pre2
load
public boolean load(View view, boolean reload)
- Loads the buffer from disk, even if it is loaded already.
- Since:
- 2.5pre1
insertFile
public boolean insertFile(View view, java.lang.String path)
- Loads a file from disk, and inserts it into this buffer.
- Since:
- 4.0pre1
autosave
public void autosave()
- Autosaves this buffer.
saveAs
public boolean saveAs(View view, boolean rename)
- Prompts the user for a file to save this buffer to.
- Since:
- jEdit 2.6pre5
save
public boolean save(View view, java.lang.String path)
- Saves this buffer to the specified path name, or the current path
name if it's null.
save
public boolean save(View view, java.lang.String path, boolean rename)
- Saves this buffer to the specified path name, or the current path
name if it's null.
- Since:
- jEdit 2.6pre5
checkFileStatus
public int checkFileStatus(View view)
- Check if the buffer has changed on disk.
- Since:
- jEdit 4.2pre1
getLastModified
public long getLastModified()
- Returns the last time jEdit modified the file on disk.
This method is thread-safe.
setLastModified
public void setLastModified(long modTime)
- Sets the last time jEdit modified the file on disk.
getVFS
public org.gjt.sp.jedit.io.VFS getVFS()
- Returns the virtual filesystem responsible for loading and
saving this buffer. This method is thread-safe.
getAutosaveFile
public java.io.File getAutosaveFile()
- Returns the autosave file for this buffer. This may be null if
the file is non-local.
getName
public java.lang.String getName()
- Returns the name of this buffer. This method is thread-safe.
getPath
public java.lang.String getPath()
- Returns the path name of this buffer. This method is thread-safe.
getSymlinkPath
public java.lang.String getSymlinkPath()
- If this file is a symbolic link, returns the link destination.
Otherwise returns the file's path. This method is thread-safe.
- Since:
- jEdit 4.2pre1
getDirectory
public java.lang.String getDirectory()
- Returns the directory containing this buffer.
- Since:
- jEdit 4.1pre11
isClosed
public boolean isClosed()
- Returns true if this buffer has been closed with
jEdit.closeBuffer(View,Buffer)55 . This method is thread-safe.
isLoaded
public boolean isLoaded()
- Returns true if the buffer is loaded. This method is thread-safe.
isPerformingIO
public boolean isPerformingIO()
- Returns true if the buffer is currently performing I/O.
This method is thread-safe.
- Since:
- jEdit 2.7pre1
isNewFile
public boolean isNewFile()
- Returns whether this buffer lacks a corresponding version on disk.
This method is thread-safe.
setNewFile
public void setNewFile(boolean newFile)
- Sets the new file flag.
isUntitled
public boolean isUntitled()
- Returns true if this file is 'untitled'. This method is thread-safe.
isDirty
public boolean isDirty()
- Returns whether there have been unsaved changes to this buffer.
This method is thread-safe.
isReadOnly
public boolean isReadOnly()
- Returns true if this file is read only, false otherwise.
This method is thread-safe.
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
setReadOnly
public void setReadOnly(boolean readOnly)
- Sets the read only flag.
setDirty
public void setDirty(boolean d)
- Sets the 'dirty' (changed since last save) flag of this buffer.
isTemporary
public boolean isTemporary()
- Returns if this is a temporary buffer. This method is thread-safe.
- Since:
- jEdit 2.2pre7
getIcon
public javax.swing.Icon getIcon()
- Returns this buffer's icon.
- Since:
- jEdit 2.6pre6
readLock
public void readLock()
- The buffer is guaranteed not to change between calls to
readLock()55 andreadUnlock()55 .
readUnlock
public void readUnlock()
- The buffer is guaranteed not to change between calls to
readLock()55 andreadUnlock()55 .
writeLock
public void writeLock()
- Attempting to obtain read lock will block between calls to
writeLock()55 andwriteUnlock()55 .
writeUnlock
public void writeUnlock()
- Attempting to obtain read lock will block between calls to
writeLock()55 andwriteUnlock()55 .
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.
- Since:
- jEdit 4.0pre1
getLineStartOffset
public int getLineStartOffset(int line)
- Returns the start offset of the specified line.
This method is thread-safe.
- Since:
- jEdit 4.0pre1
getLineEndOffset
public int getLineEndOffset(int line)
- Returns the end offset of the specified line.
This method is thread-safe.
- Since:
- jEdit 4.0pre1
getLineLength
public int getLineLength(int line)
- Returns the length of the specified line.
This method is thread-safe.
- Since:
- jEdit 4.0pre1
invalidateCachedScreenLineCounts
public void invalidateCachedScreenLineCounts()
- Invalidates all cached screen line count information.
- Since:
- jEdit 4.2pre7.
getLineText
public java.lang.String getLineText(int line)
- Returns the text on the specified line.
This method is thread-safe.
- Since:
- jEdit 4.0pre1
getLineText
public void getLineText(int line,
javax.swing.text.Segment segment)
- Returns the specified line in a
Segment.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.
- Since:
- jEdit 4.0pre1
getText
public java.lang.String getText(int start, int length)
- Returns the specified text range. This method is thread-safe.
getText
public void getText(int start,
int length,
javax.swing.text.Segment seg)
- Returns the specified text range in a
Segment.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.
insert
public void insert(int offset,
java.lang.String str)
- Inserts a string into the buffer.
- Since:
- jEdit 4.0pre1
insert
public void insert(int offset,
javax.swing.text.Segment seg)
- Inserts a string into the buffer.
- Since:
- jEdit 4.0pre1
remove
public void remove(int offset,
int length)
- Removes the specified rang efrom the buffer.
undo
public void undo(org.gjt.sp.jedit.textarea.JEditTextArea textArea)
- Undoes the most recent edit.
- Since:
- jEdit 4.0pre1
redo
public void redo(org.gjt.sp.jedit.textarea.JEditTextArea textArea)
- Redoes the most recently undone edit.
- 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
BufferChangeListener.transactionComplete(Buffer)>
BufferChangeListener.transactionComplete(Buffer)55 buffer event will get fired.- Since:
- jEdit 4.0pre6
beginCompoundEdit
public void beginCompoundEdit()
- Starts a compound edit. All edits from now on until
endCompoundEdit()55 are called will be merged into one. This can be used to make a complex operation undoable in one step. Nested calls tobeginCompoundEdit()55 behave as expected, requiring the same number ofendCompoundEdit()55 calls to end the edit.
endCompoundEdit
public void endCompoundEdit()
- Ends a compound edit. All edits performed since
beginCompoundEdit()55 was called can now be undone in one step by callingundo(JEditTextArea)55 .
insideCompoundEdit
public boolean insideCompoundEdit()
- Returns if a compound edit is currently active.
- Since:
- jEdit 3.1pre1
addBufferChangeListener
public void addBufferChangeListener(org.gjt.sp.jedit.buffer.BufferChangeListener listener, int priority)
- Adds a buffer change listener.
- Since:
- jEdi
JAVADOC
org.gjt.sp.jedit.Buffer