org.eclipse.xtext.ui.editor.reconciler
Class XtextReconciler

java.lang.Object
  extended by org.eclipse.core.runtime.PlatformObject
      extended by org.eclipse.core.internal.jobs.InternalJob
          extended by org.eclipse.core.runtime.jobs.Job
              extended by org.eclipse.xtext.ui.editor.reconciler.XtextReconciler
All Implemented Interfaces:
java.lang.Comparable, org.eclipse.core.runtime.IAdaptable, org.eclipse.jface.text.reconciler.IReconciler

public class XtextReconciler
extends org.eclipse.core.runtime.jobs.Job
implements org.eclipse.jface.text.reconciler.IReconciler

Standard JFace Reconcilers, e.g. the MonoReconciler, convert an replace event into a delete and an insert DirtyRegion. This leads to significant overhead, as DRs of different types cannot be merged, and the partial parsing has to be performed for each DR in the queue. We overcome this situation by writing our own reconciler that only creates ReplaceRegions which can always be merged, such that we have to call the partial parser only once. Additionally, we simplify the reconciler by using the Job API.

Author:
Jan Köhnlein - Initial contribution and API, Michael Clay

Nested Class Summary
protected  class XtextReconciler.DocumentListener
           
protected  class XtextReconciler.TextInputListener
          Reconciles the entire document when the document in the viewer is changed.
 
Field Summary
 
Fields inherited from class org.eclipse.core.runtime.jobs.Job
ASYNC_FINISH, BUILD, DECORATE, INTERACTIVE, LONG, NONE, RUNNING, SHORT, SLEEPING, WAITING
 
Fields inherited from class org.eclipse.core.internal.jobs.InternalJob
manager
 
Constructor Summary
XtextReconciler(XtextDocumentReconcileStrategy strategy)
           
 
Method Summary
 boolean belongsTo(java.lang.Object family)
           
protected  ReplaceRegion getAndResetReplaceRegion()
           
 org.eclipse.jface.text.reconciler.IReconcilingStrategy getReconcilingStrategy(java.lang.String contentType)
           
protected  void handleInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
           
 void install(org.eclipse.jface.text.ITextViewer textViewer)
           
protected  void pause()
           
protected  void resume()
           
protected  org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
           
 void setDelay(int delay)
           
 void setReconcilingStrategy(org.eclipse.jface.text.reconciler.IReconcilingStrategy strategy)
           
 void uninstall()
           
 
Methods inherited from class org.eclipse.core.runtime.jobs.Job
addJobChangeListener, cancel, canceling, done, getJobManager, getName, getPriority, getProperty, getResult, getRule, getState, getThread, isBlocking, isSystem, isUser, join, removeJobChangeListener, schedule, schedule, setName, setPriority, setProgressGroup, setProperty, setRule, setSystem, setThread, setUser, shouldRun, shouldSchedule, sleep, wakeUp, wakeUp
 
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob
compareTo, toString
 
Methods inherited from class org.eclipse.core.runtime.PlatformObject
getAdapter
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 
Methods inherited from interface org.eclipse.core.runtime.IAdaptable
getAdapter
 

Constructor Detail

XtextReconciler

@Inject
public XtextReconciler(XtextDocumentReconcileStrategy strategy)
Method Detail

getReconcilingStrategy

public org.eclipse.jface.text.reconciler.IReconcilingStrategy getReconcilingStrategy(java.lang.String contentType)
Specified by:
getReconcilingStrategy in interface org.eclipse.jface.text.reconciler.IReconciler

setReconcilingStrategy

public void setReconcilingStrategy(org.eclipse.jface.text.reconciler.IReconcilingStrategy strategy)

install

public void install(org.eclipse.jface.text.ITextViewer textViewer)
Specified by:
install in interface org.eclipse.jface.text.reconciler.IReconciler

uninstall

public void uninstall()
Specified by:
uninstall in interface org.eclipse.jface.text.reconciler.IReconciler

handleInputDocumentChanged

protected void handleInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
                                          org.eclipse.jface.text.IDocument newInput)

pause

protected void pause()

resume

protected void resume()

setDelay

public void setDelay(int delay)

belongsTo

public boolean belongsTo(java.lang.Object family)
Overrides:
belongsTo in class org.eclipse.core.runtime.jobs.Job

run

protected org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
Specified by:
run in class org.eclipse.core.runtime.jobs.Job

getAndResetReplaceRegion

protected ReplaceRegion getAndResetReplaceRegion()