Class PresentationReconciler
- java.lang.Object
-
- org.eclipse.jface.text.presentation.PresentationReconciler
-
- All Implemented Interfaces:
IPresentationReconciler
,IPresentationReconcilerExtension
public class PresentationReconciler extends Object implements IPresentationReconciler, IPresentationReconcilerExtension
Standard implementation ofIPresentationReconciler
. 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.
-
-
Field Summary
Fields Modifier and Type Field Description protected static String
TRACKED_PARTITION
Prefix of the name of the position category for tracking damage regions.
-
Constructor Summary
Constructors Constructor Description PresentationReconciler()
Creates a new presentation reconciler.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method 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.
-
-
-
Field Detail
-
TRACKED_PARTITION
protected static final String TRACKED_PARTITION
Prefix of the name of the position category for tracking damage regions.- See Also:
- Constant Field Values
-
-
Method Detail
-
setDocumentPartitioning
public void setDocumentPartitioning(String partitioning)
Sets the document partitioning for this presentation reconciler.- Parameters:
partitioning
- the document partitioning for this presentation reconciler.- Since:
- 3.0
-
getDocumentPartitioning
public String getDocumentPartitioning()
Description copied from interface:IPresentationReconcilerExtension
Returns the document partitioning this presentation reconciler is using.- Specified by:
getDocumentPartitioning
in interfaceIPresentationReconcilerExtension
- Returns:
- the document partitioning this presentation reconciler is using
-
setDamager
public void setDamager(IPresentationDamager damager, String contentType)
Registers the given presentation damager for a particular content type. If there is already a damager registered for this type, the old damager is removed first.- Parameters:
damager
- the presentation damager to register, ornull
to remove an existing onecontentType
- the content type under which to register
-
setRepairer
public void setRepairer(IPresentationRepairer repairer, String contentType)
Registers the given presentation repairer for a particular content type. If there is already a repairer registered for this type, the old repairer is removed first.- Parameters:
repairer
- the presentation repairer to register, ornull
to remove an existing onecontentType
- the content type under which to register
-
install
public void install(ITextViewer viewer)
Description copied from interface:IPresentationReconciler
Installs this presentation reconciler on the given text viewer. After this method has been finished, the reconciler is operational. I.e., it works without requesting further client actions untiluninstall
is called.The
install
anduninstall
methods must be called in sequence; i.e. repeatedly callinginstall
without callinguninstall
may throw an exception.- Specified by:
install
in interfaceIPresentationReconciler
- Parameters:
viewer
- the viewer on which this presentation reconciler is installed
-
uninstall
public void uninstall()
Description copied from interface:IPresentationReconciler
Removes the reconciler from the text viewer it has previously been installed on.- Specified by:
uninstall
in interfaceIPresentationReconciler
-
getDamager
public IPresentationDamager getDamager(String contentType)
Description copied from interface:IPresentationReconciler
Returns the presentation damager registered with this presentation reconciler for the specified content type.- Specified by:
getDamager
in interfaceIPresentationReconciler
- Parameters:
contentType
- the content type for which to determine the damager- Returns:
- the presentation damager registered for the given content type, or
null
if there is no damager
-
getRepairer
public IPresentationRepairer getRepairer(String contentType)
Description copied from interface:IPresentationReconciler
Returns the presentation repairer registered with this presentation reconciler for the specified content type.- Specified by:
getRepairer
in interfaceIPresentationReconciler
- Parameters:
contentType
- the content type for which to determine the repairer- Returns:
- the presentation repairer registered for the given content type, or
null
if there is no repairer
-
setDocumentToDamagers
protected void setDocumentToDamagers(IDocument document)
Informs all registered damagers about the document on which they will work.- Parameters:
document
- the document on which to work
-
setDocumentToRepairers
protected void setDocumentToRepairers(IDocument document)
Informs all registered repairers about the document on which they will work.- Parameters:
document
- the document on which to work
-
createPresentation
protected TextPresentation createPresentation(IRegion damage, IDocument document)
Constructs a "repair description" for the given damage and returns this description as a text presentation. For this, it queries the partitioning of the damage region and asks the appropriate presentation repairer for each partition to construct the "repair description" for this partition.- Parameters:
damage
- the damage to be repaireddocument
- the document whose presentation must be repaired- Returns:
- the presentation repair description as text presentation or
null
if the partitioning could not be computed
-
-