Extension SDK 10.1.2

oracle.jdeveloper.audit.model
Class TextDocumentAdapter

java.lang.Object
  extended byoracle.jdeveloper.audit.model.DocumentAdapter
      extended byoracle.jdeveloper.audit.model.TextDocumentAdapter
All Implemented Interfaces:
java.lang.Comparable, Located

public abstract class TextDocumentAdapter
extends DocumentAdapter

An abstract document adapter which specializes DocumentAdapter for text documents. In particular, when the document is open, this adapter tracks changes to the text buffer associated with the document and maps offsets across edits to the document.

When the document is opened, this adapter attaches an observer to the text buffer.

See Also:
DocumentAdapter

Nested Class Summary
protected static class TextDocumentAdapter.TextBufferTracker
          A model which tracks edits to a text buffer.
 
Field Summary
 
Fields inherited from class oracle.jdeveloper.audit.model.DocumentAdapter
index, threading
 
Constructor Summary
TextDocumentAdapter(DocumentAdapterFactory factory, DocumentTypeAdapter model, DocumentAdapter workspace, DocumentAdapter project, java.net.URL url)
           
 
Method Summary
 void beginRead()
          Begins a read transaction on this document for the current thread.
 void endRead()
          Ends the read transaction on this document for the current thread.
 int getColumnOffset(int offset)
          Gets the zero-based column offset of a character offset in this document, or the character offset if this document does not have lines and columns.
 int getDeltaLength(int offset, int length)
          Gets the change in the number of characters between an offset and a length since this document was created.
 int getDeltaOffset(int offset)
          Gets the change in the number of characters preceding an offset since this document was created.
 int getInitialLength()
          Gets the initial length of this document.
 java.lang.String getLine(int offset)
          Gets a line of text from this document, or null if this is not a text document.
 int getLineOffset(int offset)
          Gets the line offset of a character offset in this document.
 Node getNode()
          Gets the IDE node corresponding this document.
 java.lang.Object getRoot()
          Gets the root construct of the Audit object model for this document.
abstract  java.lang.Object getRootImplementation()
           
 java.lang.String getText(int offset, int length)
          Gets text from this document, or null if this is not a text document.
 void insertText(int offset, char[] text)
          Inserts text into this document.
 void insertText(int offset, java.io.Reader reader)
          Inserts text into this document.
 boolean isModifiable()
          Gets whether this document is modifiable.
 boolean isModified()
          Gets whether this document has been modified since this document adapter was created.
 void release()
          Releases resources used by this document.
 void removeText(int offset, int length)
          Removes text from this document.
protected  void startTracking()
           
protected  void stopTracking(boolean closing)
           
 java.lang.String toString()
           
 
Methods inherited from class oracle.jdeveloper.audit.model.DocumentAdapter
beginWrite, cancelWrite, compareTo, compareToDocument, compareToPackage, compareToProject, compareToWorkspace, contains, contains, endWrite, equals, getConstruct, getConstruct, getContainedConstructs, getDirectoryDocument, getElementLocations, getEndLocation, getFactory, getLocation, getLocation, getLongLabel, getPackageDirectory, getProject, getProjectDocument, getShortLabel, getSiblingComparator, getTransactionLabel, getType, getURL, getWorkspace, getWorkspaceDocument, setDirectory, sortContainedConstructs, verifyReadTransaction, verifyWriteTransaction
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

TextDocumentAdapter

public TextDocumentAdapter(DocumentAdapterFactory factory,
                           DocumentTypeAdapter model,
                           DocumentAdapter workspace,
                           DocumentAdapter project,
                           java.net.URL url)
Method Detail

getNode

public Node getNode()
Gets the IDE node corresponding this document.


isModifiable

public boolean isModifiable()
Description copied from class: DocumentAdapter
Gets whether this document is modifiable. The DocumentAdapter implementation returns false.

Overrides:
isModifiable in class DocumentAdapter

isModified

public boolean isModified()
Description copied from class: DocumentAdapter
Gets whether this document has been modified since this document adapter was created. Note that this indicates nothing about whether this document is modified relative its representation on disk.

Overrides:
isModified in class DocumentAdapter

getInitialLength

public int getInitialLength()
Description copied from class: DocumentAdapter
Gets the initial length of this document. Gets Integer.MAX_VALUE until the document is opened.

Overrides:
getInitialLength in class DocumentAdapter

getDeltaLength

public int getDeltaLength(int offset,
                          int length)
Description copied from class: DocumentAdapter
Gets the change in the number of characters between an offset and a length since this document was created.

Overrides:
getDeltaLength in class DocumentAdapter

getDeltaOffset

public int getDeltaOffset(int offset)
Description copied from class: DocumentAdapter
Gets the change in the number of characters preceding an offset since this document was created.

Overrides:
getDeltaOffset in class DocumentAdapter

beginRead

public void beginRead()
Description copied from class: DocumentAdapter
Begins a read transaction on this document for the current thread. The DocumentAdapter implementation normally does nothing; if thread diagnostics are enabled (System property audit.thread is "true"), it verifies that no read transaction for this document is active on the current thread.

Overrides:
beginRead in class DocumentAdapter

endRead

public void endRead()
Description copied from class: DocumentAdapter
Ends the read transaction on this document for the current thread. The DocumentAdapter implementation normally does nothing; if thread diagnostics are enabled (System property audit.thread is "true"), it verifies that no write transaction is active for this document and that a read transaction for this document is active on the current thread.

Overrides:
endRead in class DocumentAdapter

getColumnOffset

public int getColumnOffset(int offset)
Description copied from class: DocumentAdapter
Gets the zero-based column offset of a character offset in this document, or the character offset if this document does not have lines and columns. A read transaction must be active on this document. The DocumentAdapter implementation returns the character offset.

Overrides:
getColumnOffset in class DocumentAdapter

getLineOffset

public int getLineOffset(int offset)
Description copied from class: DocumentAdapter
Gets the line offset of a character offset in this document. A read transaction must be active on this document. The DocumentAdapter implementation returns 0.

Overrides:
getLineOffset in class DocumentAdapter

getRoot

public final java.lang.Object getRoot()
Description copied from class: DocumentAdapter
Gets the root construct of the Audit object model for this document. A read transaction must be active on this document.

Specified by:
getRoot in class DocumentAdapter

getRootImplementation

public abstract java.lang.Object getRootImplementation()

getText

public java.lang.String getText(int offset,
                                int length)
Description copied from class: DocumentAdapter
Gets text from this document, or null if this is not a text document. A read transaction must be active on this document. The DocumentAdapter implementation returns null.

Overrides:
getText in class DocumentAdapter
Parameters:
offset - The index of the first character to return.
length - The number of characters to return.

getLine

public java.lang.String getLine(int offset)
Description copied from class: DocumentAdapter
Gets a line of text from this document, or null if this is not a text document. A read transaction must be active on this document. The DocumentAdapter implementation returns null.

Overrides:
getLine in class DocumentAdapter
Parameters:
offset - The index of a character in the line to return.

removeText

public void removeText(int offset,
                       int length)
Removes text from this document. A write transaction must be active for the current thread on this document.


insertText

public void insertText(int offset,
                       char[] text)
Inserts text into this document. A write transaction must be active for the current thread on this document.


insertText

public void insertText(int offset,
                       java.io.Reader reader)
                throws java.io.IOException
Inserts text into this document. A write transaction must be active for the current thread on this document.

Throws:
java.io.IOException

startTracking

protected void startTracking()

stopTracking

protected void stopTracking(boolean closing)

release

public void release()
Description copied from class: DocumentAdapter
Releases resources used by this document.

Overrides:
release in class DocumentAdapter

toString

public java.lang.String toString()
Overrides:
toString in class DocumentAdapter

Extension SDK

 

Copyright © 1997, 2004, Oracle. All rights reserved.