# com.bea.ide.lang.control
ControlDocument Class

public class ControlDocument
extends `JavaDocument`
implements `IRelatedDocument`

A file handler for control extension files.

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

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

## 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

ControlDocument(`Class` handler, `URI` fileURI) Constructor.

## Method Summary

`public boolean` | `breakRelationship`() Alter the contents of the document if necessary to remove the relationship between this document and it's parent.
`public boolean` | `confirmBreakDialog`() Show a dialog informing the user that their action will break the relationship this document
`public void` | `createDrivers`() Creates drivers for this Java document.
`protected `List`` | `findGeneratedFiles`()
`protected `Map`` | `getGeneratorActions`()
`public `URI`` | `getParentDocument`() Get the document from which this document was derived
`public `IDocumentViewInfo`[]` | `getViewInfo`() get all the views for this document type.
`public boolean` | `isAutogenerated`() Indicates whether this document was automatically generated from the parent document.
`public boolean` | `onSave`() Method called by the document service when this document is saved.
`protected boolean` | `regenerate`(`URI` destinationURI) By default, this will check the getGenerationActions map to figure out how to regen files.

Methods from `com.bea.ide.lang.java.`JavaDocument``
``getMainClass`, `uriChanged``

Methods from `com.bea.ide.sourceeditor.`DefaultSourceDocument``
``createDrivers`, `createUndoableEditListener`, `createUndoManager`, `fireElementChildAdded`, `fireElementChildRemoved`, `fireElementModified`, `getElementFromOffset`, `getHandlerId`, `getReader`, `getSourceModel`, `getTokenFromOffset`, `isMerging`, `mergeMetadata`, `onOpen`, `onRemove`, `reload`, `requestTwoWayEdit`, `setRootElement`, `uriChanged`, `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

### ControlDocument

    public ControlDocument(Class handler,
                           URI fileURI)

  Constructor.

## Method Detail

### breakRelationship() Method

    public boolean breakRelationship()

Description copied from `IRelatedDocument.breakRelationship()`
Alter the contents of the document if necessary to remove the relationship between this document and it's parent. After this isAutogenerated() should always return false and getParentDocument() should return null. When this document is next loaded, it may not implement the IRelatedDocument interface.

Overrides
  `JavaDocument.breakRelationship()`

#### 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()

Description copied from `IRelatedDocument.confirmBreakDialog()`
Show a dialog informing the user that their action will break the relationship this document

Overrides
  `JavaDocument.confirmBreakDialog()`

#### Returns

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

### createDrivers() Method

    public void createDrivers()

Description copied from `JavaDocument.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
  `JavaDocument.createDrivers()`

### findGeneratedFiles() Method

    protected List findGeneratedFiles()

#### Returns

a List of URIs that were autogenerated from this document.

### getGeneratorActions() Method

    protected Map getGeneratorActions()

#### Returns

a Map of handlerID to IAction for regenerating the file.

### getParentDocument() Method

    public URI getParentDocument()

Description copied from `IRelatedDocument.getParentDocument()`
Get the document from which this document was derived

Overrides
  `JavaDocument.getParentDocument()`

#### Returns

URI of the parent document or null if the relationship has been previously broken

### getViewInfo() Method

    public IDocumentViewInfo[] getViewInfo()

get all the views for this document type.

Overrides
  `DefaultSourceDocument.getViewInfo()`

#### Returns

Array of `IDocumentViewInfo``` objects for this document.

### isAutogenerated() Method

    public boolean isAutogenerated()

Description copied from `IRelatedDocument.isAutogenerated()`
Indicates whether this document was automatically generated from the parent document. Typically this will cause a warning to be displayed to the user to indicate that an editing action will break the relationship.

Overrides
  `JavaDocument.isAutogenerated()`

#### Returns

true if this document's contents were generated from another document and should be protected from editing, false if the document may be edited without altering the relationship

### onSave() Method

    public boolean onSave()

Description copied from `IDocument.onSave()`
Method called by the document service when this document is saved. This is called automatically by the document service. It may return false to indicate that this document should not be saved.

Overrides
  `DefaultSourceDocument.onSave()`

#### Returns

boolean indicating whether the document should be saved

### regenerate(URI) Method

    protected boolean regenerate(URI destinationURI)

By default, this will check the getGenerationActions map to figure out how to regen files. It can be overridden as needed.