public class ProjectionDocumentManager extends Object implements IDocumentListener, ISlaveDocumentManager, ISlaveDocumentManagerExtension
ProjectionDocumentManager
is one particular implementation
of ISlaveDocumentManager
. This manager
creates so called projection documents (see
ProjectionDocument
as 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 IDocument
such as position categories and position updaters.
Clients can instantiate this class. This class is not intended to be subclassed.
Constructor and Description |
---|
ProjectionDocumentManager() |
Modifier and Type | Method and Description |
---|---|
IDocumentInformationMapping |
createMasterSlaveMapping(IDocument slave)
Creates a new document information mapping between the given slave document and
its master document.
|
protected ProjectionDocument |
createProjectionDocument(IDocument master)
Factory method for projection documents.
|
IDocument |
createSlaveDocument(IDocument master)
Creates a new slave document for the given master 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 masterEvent)
Informs all projection documents of the master document that issued the given document event.
|
void |
freeSlaveDocument(IDocument slave)
Frees the given slave document.
|
IDocument |
getMasterDocument(IDocument slave)
Returns the master document of the given slave document or
null if 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 or
null if there are no such slave document. |
boolean |
isSlaveDocument(IDocument document)
Returns whether the given document is a slave document known to this slave document manager.
|
void |
setAutoExpandMode(IDocument slave,
boolean autoExpanding)
Sets the given slave document's auto expand mode.
|
protected void fireDocumentEvent(boolean about, DocumentEvent masterEvent)
about
- indicates whether the change is about to happen or happened alreadymasterEvent
- the document event which will be processed to inform the projection documentspublic void documentChanged(DocumentEvent event)
IDocumentListener
documentChanged
in interface IDocumentListener
event
- the document event describing the document changepublic void documentAboutToBeChanged(DocumentEvent event)
IDocumentListener
documentAboutToBeChanged
in interface IDocumentListener
event
- the document event describing the document changepublic IDocumentInformationMapping createMasterSlaveMapping(IDocument slave)
ISlaveDocumentManager
null
if the given document is unknown
to this slave document manager.createMasterSlaveMapping
in interface ISlaveDocumentManager
slave
- the slave documentnull
public IDocument createSlaveDocument(IDocument master)
ISlaveDocumentManager
freeSlaveDocument
is called. The connection between the newly created slave document and the master
document is managed by this slave document manager.createSlaveDocument
in interface ISlaveDocumentManager
master
- the master documentISlaveDocumentManager.freeSlaveDocument(IDocument)
protected ProjectionDocument createProjectionDocument(IDocument master)
master
- the master documentpublic void freeSlaveDocument(IDocument slave)
ISlaveDocumentManager
createSlaveDocument
.freeSlaveDocument
in interface ISlaveDocumentManager
slave
- the slave document to be freedISlaveDocumentManager.createSlaveDocument(IDocument)
public IDocument getMasterDocument(IDocument slave)
ISlaveDocumentManager
null
if the
given document is unknown to this slave document manager.getMasterDocument
in interface ISlaveDocumentManager
slave
- the slave documentnull
public boolean isSlaveDocument(IDocument document)
ISlaveDocumentManager
isSlaveDocument
in interface ISlaveDocumentManager
document
- the document to be checked whether it is a slave document known to this managertrue
if the document is a slave document, false
otherwisepublic void setAutoExpandMode(IDocument slave, boolean autoExpanding)
ISlaveDocumentManager
This call is without effect if the given document is unknown to this slave document manager.
setAutoExpandMode
in interface ISlaveDocumentManager
slave
- the slave whose auto expand mode should be setautoExpanding
- true
for auto expand, false
otherwisepublic IDocument[] getSlaveDocuments(IDocument master)
ISlaveDocumentManagerExtension
null
if there are no such slave document.getSlaveDocuments
in interface ISlaveDocumentManagerExtension
master
- the master documentnull
Copyright (c) 2000, 2014 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.