org.eclipse.xtext.ui.editor
Class PresentationDamager

java.lang.Object
  extended by org.eclipse.xtext.ui.editor.PresentationDamager
All Implemented Interfaces:
org.eclipse.jface.text.presentation.IPresentationDamager

public class PresentationDamager
extends java.lang.Object
implements org.eclipse.jface.text.presentation.IPresentationDamager

This implementations relies on an XtextDocument, which provides information about the damaged region of the last change.

Author:
Sven Efftinge - Initial contribution and API

Constructor Summary
PresentationDamager()
           
 
Method Summary
protected  org.eclipse.jface.text.IRegion computeInterSection(org.eclipse.jface.text.ITypedRegion partition, org.eclipse.jface.text.DocumentEvent e, XtextDocument document)
           
 org.eclipse.jface.text.IRegion getDamageRegion(org.eclipse.jface.text.ITypedRegion partition, org.eclipse.jface.text.DocumentEvent e, boolean documentPartitioningChanged)
          Returns the damage in the document's presentation caused by the given document change.
protected  boolean isEventMatchingLastDamage(org.eclipse.jface.text.DocumentEvent e, org.eclipse.jface.text.IRegion lastDamage)
           
 void setDocument(org.eclipse.jface.text.IDocument document)
          Tells the presentation damager on which document it will work.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

PresentationDamager

public PresentationDamager()
Method Detail

setDocument

public void setDocument(org.eclipse.jface.text.IDocument document)
Description copied from interface: org.eclipse.jface.text.presentation.IPresentationDamager
Tells the presentation damager on which document it will work.

Specified by:
setDocument in interface org.eclipse.jface.text.presentation.IPresentationDamager
Parameters:
document - the damager's working document

getDamageRegion

public org.eclipse.jface.text.IRegion getDamageRegion(org.eclipse.jface.text.ITypedRegion partition,
                                                      org.eclipse.jface.text.DocumentEvent e,
                                                      boolean documentPartitioningChanged)
Description copied from interface: org.eclipse.jface.text.presentation.IPresentationDamager
Returns the damage in the document's presentation caused by the given document change. The damage is restricted to the specified partition for which the presentation damager is responsible. The damage may also depend on whether the document change also caused changes of the document's partitioning.

Specified by:
getDamageRegion in interface org.eclipse.jface.text.presentation.IPresentationDamager
Parameters:
partition - the partition inside which the damage must be determined
e - the event describing the change whose damage must be determined
documentPartitioningChanged - indicates whether the given change changed the document's partitioning
Returns:
the computed damage

computeInterSection

protected org.eclipse.jface.text.IRegion computeInterSection(org.eclipse.jface.text.ITypedRegion partition,
                                                             org.eclipse.jface.text.DocumentEvent e,
                                                             XtextDocument document)
Returns:
the common region of the given partition and the changed region in the DocumentEvent based on the underlying tokens.

isEventMatchingLastDamage

protected boolean isEventMatchingLastDamage(org.eclipse.jface.text.DocumentEvent e,
                                            org.eclipse.jface.text.IRegion lastDamage)
Returns:
true only if the lastDamage is encloses the affected text of the given DocumentEvent.