IRelatedDocument Interface

com.bea.ide.document
IRelatedDocument Interface

public interface IRelatedDocument

    extends IDocument

Documents that have a child relationship with another document should implement this interface. The interface allows the IDE to track the relationship and warn the user when an action they are taking will interfere with the relationship. The methods give the document an opportunity to alter the document when the relationship is broken, as well as override attempts to break the relationship.


All Known Implementing Classes
JavaDocument, ControlDocument, ControlContainerDocument
All Superinterfaces
ICookieSupport, IDocument, IDriverSupport, IElement, IPropertySupport

Field Summary

public static final String
EVENT_RelationshipInfoChanged
This is the key for an application event that indicates that the relationship information for a URI has changed.
   
Fields from interface com.bea.ide.document.IDocument
KEY_HiddenEdit, KEY_UndoManager, PROP_DocumentDeleted, PROP_DocumentDirty, PROP_DocumentEditable, PROP_DocumentReadOnly, PROP_DocumentURI, PROP_ElementModified
 

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 URI
getParentDocument()
Get the document from which this document was derived
public boolean
isAutogenerated()
Indicates whether this document was automatically generated from the parent document.
 
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
   

Field Detail

EVENT_RelationshipInfoChanged

public static final String EVENT_RelationshipInfoChanged
This is the key for an application event that indicates that the relationship information for a URI has changed. If information is stored in the file, such that a file system change will occur to the URI of the document whenever there is a change in relationship, this event is optional. If the relationship is stored entirely externally, meaning that there will NOT be a file system event for the document's URI when the relationship information changes, the owning extension is responsible for firing this event on the application. The value passed should be the URI of the document for which the information has changed. Listeners may use the IRelatedDocument or the IDocumentInfo interfaces to query the state of relationsihp information on the URI and respond accordingly.

 

Method Detail

breakRelationship() Method

public boolean 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.

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()
Show a dialog informing the user that their action will break the relationship this document

Returns

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

getParentDocument() Method

public URI getParentDocument()
Get the document from which this document was derived

Returns

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

isAutogenerated() Method

public boolean 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.

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