|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Extension interface for IDocument
. It adds the
following concepts:
Field Summary | |
---|---|
static long |
UNKNOWN_MODIFICATION_STAMP
The unknown modification stamp. |
Method Summary | |
---|---|
void |
addDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener)
Registers the document rewrite session listener with the document. |
DocumentRewriteSession |
getActiveRewriteSession()
Returns the active rewrite session of this document or null . |
String |
getDefaultLineDelimiter()
Returns this document's default line delimiter. |
long |
getModificationStamp()
Returns the modification stamp of this document. |
void |
removeDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener)
Removes the listener from the document's list of document rewrite session listeners. |
void |
replace(int offset,
int length,
String text,
long modificationStamp)
Substitutes the given text for the specified document range. |
void |
set(String text,
long modificationStamp)
Replaces the content of the document with the given text. |
void |
setInitialLineDelimiter(String lineDelimiter)
Sets this document's initial line delimiter i.e. the one which is returned by getDefaultLineDelimiter
if the document does not yet contain any line delimiter. |
DocumentRewriteSession |
startRewriteSession(DocumentRewriteSessionType sessionType)
Tells the document that it is about to be rewritten. |
void |
stopRewriteSession(DocumentRewriteSession session)
Tells the document to stop the rewrite session. |
Field Detail |
public static final long UNKNOWN_MODIFICATION_STAMP
Method Detail |
public DocumentRewriteSession startRewriteSession(DocumentRewriteSessionType sessionType) throws IllegalStateException
The document is considered being in rewrite mode as long as
stopRewriteSession
has not been called.
sessionType
- the session type
IllegalStateException
- in case there is already an active rewrite sessionpublic void stopRewriteSession(DocumentRewriteSession session)
startRewriteSession
has been called before.
This method does not have any effect if the given session is not the active rewrite session.
session
- the session to stoppublic DocumentRewriteSession getActiveRewriteSession()
null
.
null
public void addDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener)
IDocumentRewriteSessionListener
is
informed about each state change of rewrite sessions performed on this
document.
If the listener is already registered nothing happens.
An IRewriteSessionDocumentListener
may call back to this
document when being inside a document notification.
listener
- the listener to be registeredpublic void removeDocumentRewriteSessionListener(IDocumentRewriteSessionListener listener)
An IDocumentRewriteSessionListener
may call back to this
document when being inside a document notification.
listener
- the listener to be removedpublic void replace(int offset, int length, String text, long modificationStamp) throws BadLocationException
DocumentEvent
to all registered IDocumentListener
.
offset
- the document offsetlength
- the length of the specified rangetext
- the substitution textmodificationStamp
- of the document after replacing
BadLocationException
- if the offset is invalid in this documentDocumentEvent
,
IDocumentListener
public void set(String text, long modificationStamp)
DocumentEvent
to all registered IDocumentListener
.
This method is a convenience method for replace(0, getLength(), text)
.
text
- the new content of the documentmodificationStamp
- of the document after setting the contentDocumentEvent
,
IDocumentListener
public long getModificationStamp()
The magnitude or sign of the numerical difference between two modification stamps is not significant.
UNKNOWN_MODIFICATION_STAMP
public String getDefaultLineDelimiter()
This default line delimiter should be used by clients who want unique delimiters (e.g. 'CR's) in the document.
null
if nonepublic void setInitialLineDelimiter(String lineDelimiter)
getDefaultLineDelimiter
if the document does not yet contain any line delimiter.
lineDelimiter
- the default line delimiter
|
Eclipse Platform Release 3.1 |
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
Guidelines for using Eclipse APIs.
Copyright (c) IBM Corp. and others 2000, 2005. All rights reserved.