Eclipse Platform
2.0

org.eclipse.jface.text
Class ChildDocumentManager

java.lang.Object
  |
  +--org.eclipse.jface.text.ChildDocumentManager
All Implemented Interfaces:
IDocumentListener

public final class ChildDocumentManager
extends Object
implements IDocumentListener

Manages a set of child documents for given parent documents. A child document represents a particular range of the parent document and is accordingly adapted to changes of the parent document. Vice versa, the parent document is accordingly adapted to changes of its child documents. The manager does not maintain any particular management structure but utilizes mechanisms given by IDocument such as position categories and position updaters.

For internal use only.


Field Summary
static String CHILDDOCUMENTS
          Name of the position categories used to keep track of the child documents offset ranges into the parent document.
 
Constructor Summary
ChildDocumentManager()
           
 
Method Summary
 ChildDocument createChildDocument(IDocument parent, int offset, int length)
          Creates and returns a new child document for the specified range of the given parent document.
 void documentAboutToBeChanged(DocumentEvent event)
          The manipulation described by the document event will be performed.
 void documentChanged(DocumentEvent event)
          The manipulation described by the document event has been performed.
protected  void fireDocumentEvent(boolean about, DocumentEvent event)
          Informs all child documents of the document which issued this document event.
 void freeChildDocument(ChildDocument childDocument)
          Disconnects the given child document from it's parent document and frees all resources which are no longer needed.
protected  IPositionUpdater getChildPositionUpdater()
          Returns the child position updater.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CHILDDOCUMENTS

public static final String CHILDDOCUMENTS
Name of the position categories used to keep track of the child documents offset ranges into the parent document.

See Also:
Constant Field Values
Constructor Detail

ChildDocumentManager

public ChildDocumentManager()
Method Detail

getChildPositionUpdater

protected IPositionUpdater getChildPositionUpdater()
Returns the child position updater. If necessary, it is dynamically created.

Returns:
the child position updater

createChildDocument

public ChildDocument createChildDocument(IDocument parent,
                                         int offset,
                                         int length)
                                  throws BadLocationException
Creates and returns a new child document for the specified range of the given parent document. The created child document is initialized with a child document partitioner.

Parameters:
parent - the parent document
offset - the offset of the parent document range
length - the length of the parent document range
Throws:
BadLocationException - if the specified range is invalid in the parent document

freeChildDocument

public void freeChildDocument(ChildDocument childDocument)
Disconnects the given child document from it's parent document and frees all resources which are no longer needed.

Parameters:
childDocument - the child document to be freed

fireDocumentEvent

protected void fireDocumentEvent(boolean about,
                                 DocumentEvent event)
Informs all child documents of the document which issued this document event.

Parameters:
about - indicates whether the change is about to happen or alread happend
event - the document event which will be processed to inform child documents

documentChanged

public void documentChanged(DocumentEvent event)
Description copied from interface: IDocumentListener
The manipulation described by the document event has been performed.

Specified by:
documentChanged in interface IDocumentListener
Parameters:
event - the document event describing the document change

documentAboutToBeChanged

public void documentAboutToBeChanged(DocumentEvent event)
Description copied from interface: IDocumentListener
The manipulation described by the document event will be performed.

Specified by:
documentAboutToBeChanged in interface IDocumentListener
Parameters:
event - the document event describing the document change

Eclipse Platform
2.0

Copyright (c) IBM Corp. and others 2000, 2002. All Rights Reserved.