# com.bea.ide.lang.java
JavaDocument Class

public class JavaDocument
extends `TextDocument`
implements `IRelatedDocument`

A file handler for Java source files.

Hierarchy
  `Object`
  `DefaultElement`
  `DefaultDocument`
  `DefaultSourceDocument`
  `TextDocument`
  `JavaDocument`

All Implemented Interfaces
  `ICookieSupport`, `IDocument`, `IDriverSupport`, `IElement`, `IPropertySupport`, `IRelatedDocument`, `ISourceDocument`

Direct Known Subclasses
  `ControlContainerDocument`, `ControlDocument`

## Nested Class Summary

Nested classes from com.bea.ide.document`.`DefaultDocument``
``DefaultDocument.IgnoreFileSystemEvent``

## Field Summary

Fields from com.bea.ide.sourceeditor`.`DefaultSourceDocument``
``PROP_ColumnNumber`, `PROP_LineNumber``

Fields from com.bea.ide.document`.`DefaultDocument``
``KEY_MakeEditableFailed``

Fields from interface com.bea.ide.document`.`IDocument``
``KEY_HiddenEdit`, `KEY_UndoManager`, `PROP_DocumentDeleted`, `PROP_DocumentDirty`, `PROP_DocumentEditable`, `PROP_DocumentReadOnly`, `PROP_DocumentURI`, `PROP_ElementModified``

Fields from interface com.bea.ide.document`.`IRelatedDocument``
``EVENT_RelationshipInfoChanged``

Fields from interface com.bea.ide.sourceeditor`.`ISourceDocument``
``PROP_HAS_ERRORS`, `PROP_HAS_WARNINGS`, `PROP_LAST_COMPILATION`, `PROP_LAST_COMPILATION_REQUEST`, `PROP_LAST_COMPILATION_TIME`, `PROP_MID_TWOWAY_EDIT``

## Constructor Summary

JavaDocument(`Class` handler, `URI` fileURI) Creates a new document using the appropriate handler, initializing the document with data found at the specified URI.

## Method Summary

`public boolean` | `breakRelationship`() JavaDocument objects are not part of document relationships, so this method always returns null.
`public boolean` | `confirmBreakDialog`() JavaDocument objects are not part of document relationships, so this method always returns null.
`protected void` | `createDrivers`() Creates drivers for this Java document.
`public `JavaClass`` | `getMainClass`() Gets the main class in this document.
`public `URI`` | `getParentDocument`() Returns the URI of a document that should appear as this document's parent in the UI.
`public boolean` | `isAutogenerated`() Indicates whether this file is auto-generated.
`protected void` | `uriChanged`(`URI` uriOld, `URI` uriNew) When a document's URI changes, the compiler is notified of the change and a recompilation is initiated.

Methods from `com.bea.ide.sourceeditor.`DefaultSourceDocument``
``createUndoableEditListener`, `createUndoManager`, `fireElementChildAdded`, `fireElementChildRemoved`, `fireElementModified`, `getElementFromOffset`, `getHandlerId`, `getReader`, `getSourceModel`, `getTokenFromOffset`, `getViewInfo`, `isMerging`, `mergeMetadata`, `onOpen`, `onRemove`, `onSave`, `reload`, `requestTwoWayEdit`, `setRootElement`, `waitForPendingCompilations`, `waitForRootElement``

Methods from `com.bea.ide.document.`DefaultDocument``
``addCookie`, `addDriver`, `addElementChangeListener`, `addPropertyChangeListener`, `addPropertyChangeListener`, `computeEditable`, `createReadOnlyListener`, `fileSystemChanged`, `finalize`, `fireElementChildAdded`, `fireElementChildRemoved`, `fireElementModified`, `fireElementModified`, `fireElementModified`, `getCookie`, `getDriver`, `getIFile`, `getInputStream`, `getProperty`, `getRootElement`, `getRootElement`, `getURI`, `isBinary`, `isEditable`, `isModified`, `isReadOnly`, `makeEditable`, `onOpen`, `onRemove`, `onSave`, `removeCookie`, `removeElementChangeListener`, `removePropertyChangeListener`, `removePropertyChangeListener`, `setProperty`, `setRootElement`, `uriChanged`, `waitForRootElement``

Methods from `com.bea.ide.element.`DefaultElement``
``getProperty`, `getPropertyDescriptors`, `setProperty``

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Methods from interface `com.bea.ide.core.`ICookieSupport``
``addCookie`, `getCookie`, `removeCookie``

Methods from interface `com.bea.ide.document.`IDocument``
``addElementChangeListener`, `getHandlerId`, `getIFile`, `getInputStream`, `getReader`, `getRootElement`, `getRootElement`, `getURI`, `getViewInfo`, `isBinary`, `isEditable`, `isModified`, `isReadOnly`, `makeEditable`, `onOpen`, `onRemove`, `onSave`, `reload`, `removeElementChangeListener`, `waitForRootElement``

Methods from interface `com.bea.ide.core.`IDriverSupport``
``getDriver``

Methods from interface `com.bea.ide.element.`IElement``
``getProperty`, `getPropertyDescriptors`, `setProperty``

Methods from interface `com.bea.ide.core.`IPropertySupport``
``addPropertyChangeListener`, `addPropertyChangeListener`, `getProperty`, `removePropertyChangeListener`, `removePropertyChangeListener`, `setProperty``

Methods from interface `com.bea.ide.document.`IRelatedDocument``
``breakRelationship`, `confirmBreakDialog`, `getParentDocument`, `isAutogenerated``

Methods from interface `com.bea.ide.sourceeditor.`ISourceDocument``
``getElementFromOffset`, `getSourceModel`, `getTokenFromOffset`, `mergeMetadata``

## Constructor Detail

### JavaDocument

    public JavaDocument(Class handler,
                        URI fileURI)

  Creates a new document using the appropriate handler, initializing the document with data found at the specified URI.

## Method Detail

### breakRelationship() Method

    public boolean breakRelationship()

JavaDocument objects are not part of document relationships, so this method always returns null. Derived documents should override this method if document changes would be required to break a document relationship.

#### Returns

true if the relationship was successfully broken, false otherwise. A false return value will prevent user edits to the document

### confirmBreakDialog() Method

    public boolean confirmBreakDialog()

JavaDocument objects are not part of document relationships, so this method always returns null. Derived documents should override this method if document changes would be required to break a document relationship.

#### Returns

true if the user affirmed that they want to break the relationship, false otherwise

### createDrivers() Method

    protected void createDrivers()

Creates drivers for this Java document. By default, a JavaDocument has the following driver types and implementations:
`ISourceViewDriver```, implemented by `JavaSourceViewDriver```
`IDebugDriver```, implemented by `JavaDebugDriver```
`IStructureViewDriver```, implemented by `JavaStructureViewDriver```
`ICompilerDriver```, implemented by `JavaCompilerDriver```
`IPropertyViewDriver```, implementation retrieved by `CompilerSvc.get().getPropertyViewDriver```

Overrides
  `DefaultSourceDocument.createDrivers()`

### getMainClass() Method

    public JavaClass getMainClass()

Gets the main class in this document. This will return null if the file doesn't yet have a parse tree.

#### Returns

the JavaClass that represents the main class for this document.

### getParentDocument() Method

    public URI getParentDocument()

Returns the URI of a document that should appear as this document's parent in the UI. This often returns null, indicating that the file should appear as if it is a child only of its enclosing directory.

#### Returns

The parent file of this document.

### isAutogenerated() Method

    public boolean isAutogenerated()

Indicates whether this file is auto-generated. Derived types should override this method if they can be auto-generated.

#### Returns

false. Java documents are not auto-generated.

### uriChanged(URI, URI) Method

    protected void uriChanged(URI uriOld,
                              URI uriNew)

Description copied from `DefaultSourceDocument.uriChanged(URI, URI)`
When a document's URI changes, the compiler is notified of the change and a recompilation is initiated. Document types which override this method must call uriChanged in their super class.

Overrides
  `DefaultSourceDocument.uriChanged(URI, URI)`