public class Document extends Element
Document interface is implemented by objects that can
  be saved and restored. These objects are generally persisted on some 
  file system and are address using an unique URI.
  Documents are generally created using the DocumentFactory. This 
  ensures that there is always one instance of a document pointed to by
  the same URI.
The specification defines following types of documents:
Projects: containing user work,
TextDocuments: encapsulating text based files,
JavaSources: encapsulating java files, and 
XMLDocuments: encapsulating xml files. 
  When a new document class is introduced, the DocumentFactory
  must be told how to recognize the new document.  Extension writers tell 
  the document factory how to recognize newly introduced document classes 
  in the extension deployment descriptor.
| Constructor and Description | 
|---|
Document()  | 
| Modifier and Type | Method and Description | 
|---|---|
void | 
addDocumentListener(DocumentListener listener)
Add a  
DocumentListener to the listener list. | 
void | 
close()
Closes the  
Document and unloads any associated data. | 
boolean | 
equals(java.lang.Object other)  | 
ElementDisplayInfo | 
getDisplayInfo()  | 
protected javax.ide.model.spi.ElementImpl | 
getElementImpl()  | 
java.io.Reader | 
getReader()
Gets an  
Reader that can be used to read the contents
  of this object. | 
long | 
getTimestamp()
Returns the timestamp associated with the  
Document,
  which indicates the time at which the document was last modified. | 
java.net.URI | 
getURI()
Returns the  
URI that identifies this
  Document. | 
int | 
hashCode()  | 
boolean | 
isDirty()
True if the data in the object has been modified. 
 | 
boolean | 
isNew()
Returns  
true if the document's data has never been
  saved. | 
boolean | 
isOpen()
Returns  
true if the object's data has already been
  loaded. | 
boolean | 
isReadOnly()
Returns  
true if the document's data has never been
  saved. | 
void | 
markDirty(boolean dirty)
Marks the data with the specified dirty state. 
 | 
void | 
open()
Opens the  
Document and loads any associated data
  into the appropriate data structures. | 
void | 
removeDocumentListener(DocumentListener listener)
Removes a  
DocumentListener from the listener list. | 
void | 
save()
Saves the contents of the document. 
 | 
protected void | 
setDisplayInfo(ElementDisplayInfo displayInfo)
Set the display info for this element. 
 | 
void | 
setURI(java.net.URI uri)
Sets the  
URI associated with this Document. | 
getIcon, getLabel, getLongLabel, getToolTipprotected final javax.ide.model.spi.ElementImpl getElementImpl()
getElementImpl in class Elementprotected final void setDisplayInfo(ElementDisplayInfo displayInfo)
displayInfo - the display info for this document. If null, the
    IDE will display this element in whatever the default way is standard
    for elements of this type.public ElementDisplayInfo getDisplayInfo()
public final java.net.URI getURI()
URI that identifies this
  Document.  Parts of the IDE will use the value of
  this URI as a hash key for caching UI components for this
  Document.  Therefore, URI uniqueness is
  important.URI identifying this Document.public final void setURI(java.net.URI uri)
URI associated with this Document.
  It is important that the URI only be changed when the
  Document has just been created or when all caches
  keyed on the previous URI can also be updated.uri - The URI to set.public final boolean isOpen()
true if the object's data has already been
  loaded.public final boolean isNew()
true if the document's data has never been
  saved.public final void open()
                throws java.io.IOException
Document and loads any associated data
  into the appropriate data structures. This method notifies listeners
  if the document is successfully opened.java.io.IOException - if the document cannot be opened.public final void close()
                 throws java.io.IOException
Document and unloads any associated data.
  When this method returns, the state of the Document
  object should be equivalent to when the Document
  object has just been instantiated but not yet opened.java.io.IOException - if the document cannot be closed.public final void save()
                throws java.io.IOException
java.io.IOExceptionpublic final boolean isReadOnly()
true if the document's data has never been
  saved.true if the document's data has never been
  saved.public final boolean isDirty()
true if the data in the object has been modified.public final void markDirty(boolean dirty)
dirty - If true, sets the object as being
  dirty; if false, sets the object as being up-to-date.public final long getTimestamp()
Document,
  which indicates the time at which the document was last modified.
  The returned long is expressed in milliseconds since
  00:00:00 GMT Jan 1, 1970.Document's time stamp.public final java.io.Reader getReader()
                               throws java.io.IOException
Reader that can be used to read the contents
  of this object.Reader, or null if the
  document has no contents.java.io.IOException - if a security manager exists and its
             checkRead method denies read access.public final void addDocumentListener(DocumentListener listener)
DocumentListener to the listener list.
 A DocumentEvent will be fired in response modifying
 the contents of this document.public final void removeDocumentListener(DocumentListener listener)
DocumentListener from the listener list.public final int hashCode()
hashCode in class java.lang.Objectpublic boolean equals(java.lang.Object other)
equals in class java.lang.Object