Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

org.eclipse.jface.text.reconciler
Class AbstractReconciler  view AbstractReconciler download AbstractReconciler.java

java.lang.Object
  extended byorg.eclipse.jface.text.reconciler.AbstractReconciler
All Implemented Interfaces:
IReconciler
Direct Known Subclasses:
MonoReconciler, Reconciler

public abstract class AbstractReconciler
extends java.lang.Object
implements IReconciler

Abstract implementation of IReconciler. The reconciler listens to input document changes as well as changes of the input document of the text viewer it is installed on. Depending on its configuration it manages the received change notifications in a queue folding neighboring or overlapping changes together. The reconciler processes the dirty regions as a background activity after having waited for further changes for the configured duration of time. A reconciler is started using the install(ITextViewer) 55 method. As a first step initialProcess() 55 is executed in the background. Then, the reconciling thread waits for changes that need to be reconciled. A reconciler can be resumed by calling forceReconciling() 55 independent from the existence of actual changes. This mechanism is for subclasses only. It is the clients responsibility to stop a reconciler using its uninstall() 55 method. Unstopped reconcilers do not free their resources.

It is subclass responsibility to specify how dirty regions are processed.

Since:
2.0

Nested Class Summary
(package private)  class AbstractReconciler.BackgroundThread
          Background thread for the reconciling activity.
(package private)  class AbstractReconciler.Listener
          Internal document listener and text input listener.
 
Field Summary
private  int fDelay
          The background thread delay.
private  DirtyRegionQueue fDirtyRegionQueue
          Queue to manage the changes applied to the text viewer.
private  org.eclipse.jface.text.IDocument fDocument
          The text viewer's document.
private  boolean fIsIncrementalReconciler
          Are there incremental reconciling strategies?
private  AbstractReconciler.Listener fListener
          Internal document and text input listener.
private  org.eclipse.core.runtime.IProgressMonitor fProgressMonitor
          The progress monitor used by this reconciler.
private  AbstractReconciler.BackgroundThread fThread
          The background thread.
private  org.eclipse.jface.text.ITextViewer fViewer
          The text viewer
 
Constructor Summary
protected AbstractReconciler()
          Creates a new reconciler without configuring it.
 
Method Summary
protected  void aboutToBeReconciled()
          Hook for subclasses which want to perform some action as soon as reconciliation is needed.
private  void createDirtyRegion(org.eclipse.jface.text.DocumentEvent e)
          Creates a dirty region for a document event and adds it to the queue.
protected  void forceReconciling()
          Forces the reconciler to reconcile the structure of the whole document.
protected  org.eclipse.jface.text.IDocument getDocument()
          Returns the input document of the text viewer this reconciler is installed on.
protected  org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
          Returns the progress monitor of this reconciler.
protected  org.eclipse.jface.text.ITextViewer getTextViewer()
          Returns the text viewer this reconciler is installed on.
protected  void initialProcess()
          This method is called on startup of the background activity.
 void install(org.eclipse.jface.text.ITextViewer textViewer)
          Installs the reconciler on the given text viewer.
protected  boolean isIncrementalReconciler()
          Returns whether any of the reconciling strategies is interested in detailed dirty region information.
protected abstract  void process(DirtyRegion dirtyRegion)
          Processes a dirty region.
protected abstract  void reconcilerDocumentChanged(org.eclipse.jface.text.IDocument newDocument)
          Hook called when the document whose contents should be reconciled has been changed, i.e., the input document of the text viewer this reconciler is installed on.
protected  void reconcilerReset()
          Hook that is called after the reconciler thread has been reset.
 void setDelay(int delay)
          Tells the reconciler how long it should wait for further text changes before activating the appropriate reconciling strategies.
 void setIsIncrementalReconciler(boolean isIncremental)
          Tells the reconciler whether any of the available reconciling strategies is interested in getting detailed dirty region information or just in the fact the the document has been changed.
 void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
          Sets the progress monitor of this reconciler.
protected  void startReconciling()
          Starts the reconciler to reconcile the queued dirty-regions.
 void uninstall()
          Removes the reconciler from the text viewer it has previously been installed on.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.eclipse.jface.text.reconciler.IReconciler
getReconcilingStrategy
 

Field Detail

fDirtyRegionQueue

private DirtyRegionQueue fDirtyRegionQueue
Queue to manage the changes applied to the text viewer.


fThread

private AbstractReconciler.BackgroundThread fThread
The background thread.


fListener

private AbstractReconciler.Listener fListener
Internal document and text input listener.


fDelay

private int fDelay
The background thread delay.


fIsIncrementalReconciler

private boolean fIsIncrementalReconciler
Are there incremental reconciling strategies?


fProgressMonitor

private org.eclipse.core.runtime.IProgressMonitor fProgressMonitor
The progress monitor used by this reconciler.


fDocument

private org.eclipse.jface.text.IDocument fDocument
The text viewer's document.


fViewer

private org.eclipse.jface.text.ITextViewer fViewer
The text viewer

Constructor Detail

AbstractReconciler

protected AbstractReconciler()
Creates a new reconciler without configuring it.

Method Detail

process

protected abstract void process(DirtyRegion dirtyRegion)
Processes a dirty region. If the dirty region is null the whole document is consider being dirty. The dirty region is partitioned by the document and each partition is handed over to a reconciling strategy registered for the partition's content type.


reconcilerDocumentChanged

protected abstract void reconcilerDocumentChanged(org.eclipse.jface.text.IDocument newDocument)
Hook called when the document whose contents should be reconciled has been changed, i.e., the input document of the text viewer this reconciler is installed on. Usually, subclasses use this hook to inform all their reconciling strategies about the change.


setDelay

public void setDelay(int delay)
Tells the reconciler how long it should wait for further text changes before activating the appropriate reconciling strategies.


setIsIncrementalReconciler

public void setIsIncrementalReconciler(boolean isIncremental)
Tells the reconciler whether any of the available reconciling strategies is interested in getting detailed dirty region information or just in the fact the the document has been changed. In the second case, the reconciling can not incrementally be pursued.


setProgressMonitor

public void setProgressMonitor(org.eclipse.core.runtime.IProgressMonitor monitor)
Sets the progress monitor of this reconciler.


isIncrementalReconciler

protected boolean isIncrementalReconciler()
Returns whether any of the reconciling strategies is interested in detailed dirty region information.


getDocument

protected org.eclipse.jface.text.IDocument getDocument()
Returns the input document of the text viewer this reconciler is installed on.


getTextViewer

protected org.eclipse.jface.text.ITextViewer getTextViewer()
Returns the text viewer this reconciler is installed on.


getProgressMonitor

protected org.eclipse.core.runtime.IProgressMonitor getProgressMonitor()
Returns the progress monitor of this reconciler.


install

public void install(org.eclipse.jface.text.ITextViewer textViewer)
Description copied from interface: IReconciler
Installs the 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 until uninstall is called.

Specified by:
install in interface IReconciler

uninstall

public void uninstall()
Description copied from interface: IReconciler
Removes the reconciler from the text viewer it has previously been installed on.

Specified by:
uninstall in interface IReconciler

createDirtyRegion

private void createDirtyRegion(org.eclipse.jface.text.DocumentEvent e)
Creates a dirty region for a document event and adds it to the queue.


aboutToBeReconciled

protected void aboutToBeReconciled()
Hook for subclasses which want to perform some action as soon as reconciliation is needed.

Default implementation is to do nothing.

Since:
3.0

initialProcess

protected void initialProcess()
This method is called on startup of the background activity. It is called only once during the life time of the reconciler. Clients may reimplement this method.


forceReconciling

protected void forceReconciling()
Forces the reconciler to reconcile the structure of the whole document. Clients may extend this method.


startReconciling

protected void startReconciling()
Starts the reconciler to reconcile the queued dirty-regions. Clients may extend this method.


reconcilerReset

protected void reconcilerReset()
Hook that is called after the reconciler thread has been reset.