Class ProjectionDocumentManager
- java.lang.Object
-
- org.eclipse.jface.text.projection.ProjectionDocumentManager
-
- All Implemented Interfaces:
IDocumentListener,ISlaveDocumentManager,ISlaveDocumentManagerExtension
- Direct Known Subclasses:
ChildDocumentManager
public class ProjectionDocumentManager extends Object implements IDocumentListener, ISlaveDocumentManager, ISlaveDocumentManagerExtension
AProjectionDocumentManageris one particular implementation ofISlaveDocumentManager. This manager creates so called projection documents (seeProjectionDocumentas slave documents for given master documents.A projection document represents a particular projection of the master document and is accordingly adapted to changes of the master document. Vice versa, the master document is accordingly adapted to changes of its slave documents. The manager does not maintain any particular management structure but utilizes mechanisms given by
IDocumentsuch as position categories and position updaters.Clients can instantiate this class. This class is not intended to be subclassed.
- Since:
- 3.0
- Restriction:
- This class is not intended to be subclassed by clients.
-
-
Constructor Summary
Constructors Constructor Description ProjectionDocumentManager()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IDocumentInformationMappingcreateMasterSlaveMapping(IDocument slave)Creates a new document information mapping between the given slave document and its master document.protected ProjectionDocumentcreateProjectionDocument(IDocument master)Factory method for projection documents.IDocumentcreateSlaveDocument(IDocument master)Creates a new slave document for the given master document.voiddocumentAboutToBeChanged(DocumentEvent event)The manipulation described by the document event will be performed.voiddocumentChanged(DocumentEvent event)The manipulation described by the document event has been performed.protected voidfireDocumentEvent(boolean about, DocumentEvent masterEvent)Informs all projection documents of the master document that issued the given document event.voidfreeSlaveDocument(IDocument slave)Frees the given slave document.IDocumentgetMasterDocument(IDocument slave)Returns the master document of the given slave document ornullif the given document is unknown to this slave document manager.IDocument[]getSlaveDocuments(IDocument master)Returns the list of slave documents for the given master document ornullif there are no such slave document.booleanisSlaveDocument(IDocument document)Returns whether the given document is a slave document known to this slave document manager.voidsetAutoExpandMode(IDocument slave, boolean autoExpanding)Sets the given slave document's auto expand mode.
-
-
-
Method Detail
-
fireDocumentEvent
protected void fireDocumentEvent(boolean about, DocumentEvent masterEvent)Informs all projection documents of the master document that issued the given document event.- Parameters:
about- indicates whether the change is about to happen or happened alreadymasterEvent- the document event which will be processed to inform the projection documents
-
documentChanged
public void documentChanged(DocumentEvent event)
Description copied from interface:IDocumentListenerThe manipulation described by the document event has been performed.- Specified by:
documentChangedin interfaceIDocumentListener- Parameters:
event- the document event describing the document change
-
documentAboutToBeChanged
public void documentAboutToBeChanged(DocumentEvent event)
Description copied from interface:IDocumentListenerThe manipulation described by the document event will be performed.- Specified by:
documentAboutToBeChangedin interfaceIDocumentListener- Parameters:
event- the document event describing the document change
-
createMasterSlaveMapping
public IDocumentInformationMapping createMasterSlaveMapping(IDocument slave)
Description copied from interface:ISlaveDocumentManagerCreates a new document information mapping between the given slave document and its master document. Returnsnullif the given document is unknown to this slave document manager.- Specified by:
createMasterSlaveMappingin interfaceISlaveDocumentManager- Parameters:
slave- the slave document- Returns:
- a document information mapping between the slave document and its master document or
null
-
createSlaveDocument
public IDocument createSlaveDocument(IDocument master)
Description copied from interface:ISlaveDocumentManagerCreates a new slave document for the given master document. The slave document is causally connected to its master document untilfreeSlaveDocumentis called. The connection between the newly created slave document and the master document is managed by this slave document manager.- Specified by:
createSlaveDocumentin interfaceISlaveDocumentManager- Parameters:
master- the master document- Returns:
- the newly created slave document
- See Also:
ISlaveDocumentManager.freeSlaveDocument(IDocument)
-
createProjectionDocument
protected ProjectionDocument createProjectionDocument(IDocument master)
Factory method for projection documents.- Parameters:
master- the master document- Returns:
- the newly created projection document
-
freeSlaveDocument
public void freeSlaveDocument(IDocument slave)
Description copied from interface:ISlaveDocumentManagerFrees the given slave document. If the given document is not a slave document known to this slave document manager, this call does not have any effect. A slave document is known to this slave document manager if it has been created by this manager usingcreateSlaveDocument.- Specified by:
freeSlaveDocumentin interfaceISlaveDocumentManager- Parameters:
slave- the slave document to be freed- See Also:
ISlaveDocumentManager.createSlaveDocument(IDocument)
-
getMasterDocument
public IDocument getMasterDocument(IDocument slave)
Description copied from interface:ISlaveDocumentManagerReturns the master document of the given slave document ornullif the given document is unknown to this slave document manager.- Specified by:
getMasterDocumentin interfaceISlaveDocumentManager- Parameters:
slave- the slave document- Returns:
- the master document of the given slave document or
null
-
isSlaveDocument
public boolean isSlaveDocument(IDocument document)
Description copied from interface:ISlaveDocumentManagerReturns whether the given document is a slave document known to this slave document manager. A slave document is known to this slave document manager, if the document has been created by this manager.- Specified by:
isSlaveDocumentin interfaceISlaveDocumentManager- Parameters:
document- the document to be checked whether it is a slave document known to this manager- Returns:
trueif the document is a slave document,falseotherwise
-
setAutoExpandMode
public void setAutoExpandMode(IDocument slave, boolean autoExpanding)
Description copied from interface:ISlaveDocumentManagerSets the given slave document's auto expand mode. In auto expand mode, a slave document is automatically adapted to reflect all changes applied to its master document. Assume a master document contains 30 lines and the slave is defined to contain the lines 11-20. In auto expand mode, when the master document is changed at line 8, the slave document is expanded to contain the lines 8-20.This call is without effect if the given document is unknown to this slave document manager.
- Specified by:
setAutoExpandModein interfaceISlaveDocumentManager- Parameters:
slave- the slave whose auto expand mode should be setautoExpanding-truefor auto expand,falseotherwise
-
getSlaveDocuments
public IDocument[] getSlaveDocuments(IDocument master)
Description copied from interface:ISlaveDocumentManagerExtensionReturns the list of slave documents for the given master document ornullif there are no such slave document.- Specified by:
getSlaveDocumentsin interfaceISlaveDocumentManagerExtension- Parameters:
master- the master document- Returns:
- the list of slave documents or
null
-
-