gnu.jemacs.swt
Class SwtBuffer

java.lang.Object
  extended by gnu.lists.AbstractSequence
      extended by gnu.jemacs.buffer.Buffer
          extended by gnu.jemacs.swt.SwtBuffer
All Implemented Interfaces:
CharSeq, Consumable, Sequence, java.lang.CharSequence, java.lang.Iterable, java.util.Collection, java.util.List

public class SwtBuffer
extends Buffer


Field Summary
 
Fields inherited from class gnu.jemacs.buffer.Buffer
activeKeymaps, buffers, fileBuffers, markMarker, pointMarker
 
Fields inherited from interface gnu.lists.Sequence
ATTRIBUTE_VALUE, BOOLEAN_VALUE, CDATA_VALUE, CHAR_VALUE, COMMENT_VALUE, DOCUMENT_VALUE, DOUBLE_VALUE, EOF_VALUE, eofValue, FLOAT_VALUE, GROUP_VALUE, INT_S16_VALUE, INT_S32_VALUE, INT_S64_VALUE, INT_S8_VALUE, INT_U16_VALUE, INT_U32_VALUE, INT_U64_VALUE, INT_U8_VALUE, OBJECT_VALUE, PRIM_VALUE, PROCESSING_INSTRUCTION_VALUE, TEXT_BYTE_VALUE
 
Constructor Summary
SwtBuffer(java.lang.String name)
           
SwtBuffer(java.lang.String name, BufferContent content)
           
 
Method Summary
 int createPos(int index, boolean isAfter)
          Generate a position at a given index.
 int forwardLine(int lines)
           
 java.lang.Object get(int index)
          See java.util.List.
 org.eclipse.swt.custom.StyledTextContent getBufferContent()
           
 int getDot()
           
 int getLength()
           
 FString getModelineFormat()
           
 CharSeq getStringContent()
           
 void insert(char ch, int count)
          Insert count copies of ch at point.
 void insert(char ch, int count, java.lang.Object style)
          Insert count copies of ch at point.
 void insert(java.lang.String string, java.lang.Object style, int ipos)
          Insert string with given style at position pair.
 void insertFile(java.io.Reader in)
           
 void invoke(java.lang.Runnable doRun)
          This is intended for Runnable's that may affect the state of the buffer.
 int lineStartOffset(int offset)
           
 int maxDot()
           
 InPort openReader(int start, int count)
           
 void redrawModeline()
           
 void removeAll()
           
 void removeChar(int count)
           
 void restorePointMark(long pointMark)
           
 void save(java.io.Writer out)
           
 long savePointMark()
           
 long scan(char target, int start, int end, int count, boolean allowQuit)
          Search in BUF for COUNT instances of the character TARGET between START and END.
 void setDot(int dot)
           
 int size()
          See java.util.List.
 
Methods inherited from class gnu.jemacs.buffer.Buffer
backwardChar, charAt, charWidth, checkMark, coerceBuffer, consume, countColumns, currentColumn, currentColumn, display, fill, fill, findFile, forwardChar, forwardLine, generateNewBufferName, getBuffer, getChars, getCurrent, getFileName, getLocalKeymap, getMarkMarker, getName, getPoint, getPointMarker, insert, insert, insert, insertAll, insertFile, length, lineStartOffset, makeBufferLocal, minDot, moveToColumn, positionToOffset, save, setCharAt, setCurrent, setFileName, setLocalKeymap, setPoint, subSequence, toString, writeTo, writeTo
 
Methods inherited from class gnu.lists.AbstractSequence
add, add, addAll, addAll, addPos, append, append, append, baseUriOfPos, clear, compare, compare, compare, consume, consumeNext, consumePosRange, contains, containsAll, copyPos, createRelativePos, elements, endPos, equals, equals, fill, fill, fillPosRange, firstAttributePos, firstChildPos, fromEndIndex, get, getAttribute, getAttributeLength, getContainingSequenceSize, getEffectiveIndex, getIndexDifference, getIterator, getIterator, getIteratorAtPos, getLowBound, getNextKind, getNextTypeName, getNextTypeObject, getPosNext, getPosPrevious, getSize, gotoAttributesStart, gotoChildrenStart, gotoParent, hashCode, hasNext, hasPrevious, indexOf, isAfterPos, isEmpty, iterator, lastIndexOf, listIterator, listIterator, nextIndex, nextIndex, nextMatching, nextPos, parentPos, previousPos, rank, releasePos, remove, remove, removeAll, removePos, removePosRange, retainAll, set, set, setPosNext, setPosPrevious, stableCompare, startPos, subList, subSequence, subSequencePos, toArray, toArray, toString, unsupported
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface gnu.lists.Sequence
elements, fill, isEmpty
 
Methods inherited from interface java.util.List
add, add, addAll, addAll, clear, contains, containsAll, equals, hashCode, indexOf, iterator, lastIndexOf, listIterator, listIterator, remove, remove, removeAll, retainAll, set, subList, toArray, toArray
 
Methods inherited from interface gnu.lists.Consumable
consume
 

Constructor Detail

SwtBuffer

public SwtBuffer(java.lang.String name)

SwtBuffer

public SwtBuffer(java.lang.String name,
                 BufferContent content)
Method Detail

redrawModeline

public void redrawModeline()
Specified by:
redrawModeline in class Buffer
See Also:
Buffer.redrawModeline()

getModelineFormat

public FString getModelineFormat()

getLength

public int getLength()
Specified by:
getLength in class Buffer
See Also:
Buffer.getLength()

getDot

public int getDot()
Overrides:
getDot in class Buffer
See Also:
Buffer.getDot()

setDot

public void setDot(int dot)
Overrides:
setDot in class Buffer
See Also:
Buffer.setDot(int)

maxDot

public int maxDot()
Specified by:
maxDot in class Buffer
See Also:
Buffer.maxDot()

insert

public void insert(java.lang.String string,
                   java.lang.Object style,
                   int ipos)
Description copied from class: Buffer
Insert string with given style at position pair.

Specified by:
insert in class Buffer
See Also:
Buffer.insert(java.lang.String, java.lang.Object, int)

insert

public void insert(char ch,
                   int count,
                   java.lang.Object style)
Description copied from class: Buffer
Insert count copies of ch at point.

Overrides:
insert in class Buffer
See Also:
Buffer.insert(char, int, java.lang.Object)

insert

public void insert(char ch,
                   int count)
Description copied from class: Buffer
Insert count copies of ch at point.

Overrides:
insert in class Buffer
See Also:
Buffer.insert(char, int)

removeAll

public void removeAll()
Specified by:
removeAll in class Buffer
See Also:
Buffer.removeAll()

insertFile

public void insertFile(java.io.Reader in)
                throws java.lang.Exception
Specified by:
insertFile in class Buffer
Throws:
java.lang.Exception
See Also:
Buffer.insertFile(java.io.Reader)

save

public void save(java.io.Writer out)
          throws java.lang.Exception
Specified by:
save in class Buffer
Throws:
java.lang.Exception
See Also:
Buffer.save(java.io.Writer)

removeChar

public void removeChar(int count)
Overrides:
removeChar in class Buffer
See Also:
Buffer.removeChar(int)

lineStartOffset

public int lineStartOffset(int offset)
Specified by:
lineStartOffset in class Buffer
See Also:
Buffer.lineStartOffset(int)

scan

public long scan(char target,
                 int start,
                 int end,
                 int count,
                 boolean allowQuit)
Description copied from class: Buffer
Search in BUF for COUNT instances of the character TARGET between START and END. If COUNT is positive, search forwards; END must be >= START. If COUNT is negative, search backwards for the -COUNTth instance; END must be <= START. If COUNT is zero, do anything you please; run rogue, for all I care. If END is zero, use beginning or end of (FIXME: accessible part of) the buffer, as appropriate for the direction indicated by COUNT. If we find COUNT instances, SHORTAGE is zero, and return the position after the COUNTth match. Note that for reverse motion this is not the same as the usual convention for Emacs motion commands. If we don't find COUNT instances before reaching END, set SHORTAGE to the number of TARGETs left unfound, and return (shortage<<32|END).

Specified by:
scan in class Buffer
Returns:
(SHORTAGE<<32|POS)
See Also:
Buffer.scan(char, int, int, int, boolean)

getStringContent

public CharSeq getStringContent()
Specified by:
getStringContent in class Buffer

openReader

public InPort openReader(int start,
                         int count)
Specified by:
openReader in class Buffer
See Also:
Buffer.openReader(int, int)

savePointMark

public long savePointMark()
Specified by:
savePointMark in class Buffer
See Also:
Buffer.savePointMark()

restorePointMark

public void restorePointMark(long pointMark)
Specified by:
restorePointMark in class Buffer
See Also:
Buffer.restorePointMark(long)

invoke

public void invoke(java.lang.Runnable doRun)
Description copied from class: Buffer
This is intended for Runnable's that may affect the state of the buffer. The implementation should make shure that the GUI is properly updated before control returns

Specified by:
invoke in class Buffer
See Also:
Buffer.invoke(java.lang.Runnable)

size

public int size()
Description copied from class: AbstractSequence
See java.util.List.

Specified by:
size in interface Sequence
Specified by:
size in interface java.util.Collection
Specified by:
size in interface java.util.List
Specified by:
size in class AbstractSequence
See Also:
AbstractSequence.size()

get

public java.lang.Object get(int index)
Description copied from class: AbstractSequence
See java.util.List.

Specified by:
get in interface Sequence
Specified by:
get in interface java.util.List
Specified by:
get in class AbstractSequence
See Also:
AbstractSequence.get(int)

createPos

public int createPos(int index,
                     boolean isAfter)
Description copied from class: AbstractSequence
Generate a position at a given index. The result is a position cookie that must be free'd with releasePos.

Specified by:
createPos in class AbstractSequence
Parameters:
index - offset from beginning of desired position
isAfter - should the position have the isAfter property
See Also:
AbstractSequence.createPos(int, boolean)

getBufferContent

public org.eclipse.swt.custom.StyledTextContent getBufferContent()

forwardLine

public int forwardLine(int lines)
Overrides:
forwardLine in class Buffer
See Also:
Buffer.forwardLine(int)