public class PresentationReconciler extends Object implements IPresentationReconciler, IPresentationReconcilerExtension
IPresentationReconciler. This
implementation assumes that the tasks performed by its presentation damagers
and repairers are lightweight and of low cost. This presentation reconciler
runs in the UI thread and always repairs the complete damage caused by a
document change rather than just the portion overlapping with the viewer's
viewport.
Usually, clients instantiate this class and configure it before using it.
| Modifier and Type | Field and Description |
|---|---|
protected static String |
TRACKED_PARTITION
Prefix of the name of the position category for tracking damage regions.
|
| Constructor and Description |
|---|
PresentationReconciler()
Creates a new presentation reconciler.
|
| Modifier and Type | Method and Description |
|---|---|
protected TextPresentation |
createPresentation(IRegion damage,
IDocument document)
Constructs a "repair description" for the given damage and returns this
description as a text presentation.
|
IPresentationDamager |
getDamager(String contentType)
Returns the presentation damager registered with this presentation reconciler
for the specified content type.
|
String |
getDocumentPartitioning()
Returns the document partitioning this presentation reconciler is using.
|
IPresentationRepairer |
getRepairer(String contentType)
Returns the presentation repairer registered with this presentation reconciler
for the specified content type.
|
void |
install(ITextViewer viewer)
Installs this presentation reconciler on the given text viewer.
|
void |
setDamager(IPresentationDamager damager,
String contentType)
Registers the given presentation damager for a particular content type.
|
void |
setDocumentPartitioning(String partitioning)
Sets the document partitioning for this presentation reconciler.
|
protected void |
setDocumentToDamagers(IDocument document)
Informs all registered damagers about the document on which they will work.
|
protected void |
setDocumentToRepairers(IDocument document)
Informs all registered repairers about the document on which they will work.
|
void |
setRepairer(IPresentationRepairer repairer,
String contentType)
Registers the given presentation repairer for a particular content type.
|
void |
uninstall()
Removes the reconciler from the text viewer it has previously been
installed on.
|
protected static final String TRACKED_PARTITION
public PresentationReconciler()
IDocumentExtension3.DEFAULT_PARTITIONING is used.public void setDocumentPartitioning(String partitioning)
partitioning - the document partitioning for this presentation reconciler.public String getDocumentPartitioning()
IPresentationReconcilerExtensiongetDocumentPartitioning in interface IPresentationReconcilerExtensionpublic void setDamager(IPresentationDamager damager, String contentType)
damager - the presentation damager to register, or null to remove an existing onecontentType - the content type under which to registerpublic void setRepairer(IPresentationRepairer repairer, String contentType)
repairer - the presentation repairer to register, or null to remove an existing onecontentType - the content type under which to registerpublic void install(ITextViewer viewer)
IPresentationReconcileruninstall is called.
The install and uninstall methods must be
called in sequence; i.e. repeatedly calling install
without calling uninstall may throw an exception.
install in interface IPresentationReconcilerviewer - the viewer on which this presentation reconciler is
installedpublic void uninstall()
IPresentationReconcileruninstall in interface IPresentationReconcilerpublic IPresentationDamager getDamager(String contentType)
IPresentationReconcilergetDamager in interface IPresentationReconcilercontentType - the content type for which to determine the damagernull if there is no damagerpublic IPresentationRepairer getRepairer(String contentType)
IPresentationReconcilergetRepairer in interface IPresentationReconcilercontentType - the content type for which to determine the repairernull if there is no repairerprotected void setDocumentToDamagers(IDocument document)
document - the document on which to workprotected void setDocumentToRepairers(IDocument document)
document - the document on which to workprotected TextPresentation createPresentation(IRegion damage, IDocument document)
damage - the damage to be repaireddocument - the document whose presentation must be repairednull if the partitioning could not be computedGuidelines for using Eclipse APIs. Copyright (c) IBM Corp. and others 2000, 2006. All rights reserved.