public abstract class AbstractReconciler extends Object implements IReconciler
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)
method. As a first step initialProcess()
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()
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()
method. Unstopped reconcilers do not free their resources.
It is subclass responsibility to specify how dirty regions are processed.
IDocumentListener
,
ITextInputListener
,
DirtyRegion
Modifier | Constructor and Description |
---|---|
protected |
AbstractReconciler()
Creates a new reconciler without configuring it.
|
Modifier and Type | Method and Description |
---|---|
protected void |
aboutToBeReconciled()
Hook for subclasses which want to perform some
action as soon as reconciliation is needed.
|
protected void |
forceReconciling()
Forces the reconciler to reconcile the structure of the whole document.
|
protected IDocument |
getDocument()
Returns the input document of the text viewer this reconciler is installed on.
|
protected IProgressMonitor |
getProgressMonitor()
Returns the progress monitor of this reconciler.
|
protected 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(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 boolean |
isRunningInReconcilerThread()
Tells whether the code is running in this reconciler's
background thread.
|
protected abstract void |
process(DirtyRegion dirtyRegion)
Processes a dirty region.
|
protected abstract void |
reconcilerDocumentChanged(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 |
setIsAllowedToModifyDocument(boolean isAllowedToModify)
Tells the reconciler whether it is allowed to change the document
inside its reconciler thread.
|
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 that the document has been changed.
|
void |
setProgressMonitor(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.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getReconcilingStrategy
protected AbstractReconciler()
protected abstract void process(DirtyRegion dirtyRegion)
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.dirtyRegion
- the dirty region to be processedprotected abstract void reconcilerDocumentChanged(IDocument newDocument)
newDocument
- the new reconciler documentpublic void setDelay(int delay)
delay
- the duration in milliseconds of a change collection period.public void setIsIncrementalReconciler(boolean isIncremental)
isIncremental
- indicates whether this reconciler will be configured with
incremental reconciling strategiesDirtyRegion
,
IReconcilingStrategy
public void setIsAllowedToModifyDocument(boolean isAllowedToModify)
If this is set to false
an UnsupportedOperationException
will be thrown when this restriction will be violated.
isAllowedToModify
- indicates whether this reconciler is allowed to modify the documentpublic void setProgressMonitor(IProgressMonitor monitor)
monitor
- the monitor to be usedprotected boolean isIncrementalReconciler()
IReconcilingStrategy
protected IDocument getDocument()
protected ITextViewer getTextViewer()
protected IProgressMonitor getProgressMonitor()
public void install(ITextViewer textViewer)
IReconciler
uninstall
is called.install
in interface IReconciler
textViewer
- the viewer on which the reconciler is installedpublic void uninstall()
IReconciler
uninstall
in interface IReconciler
protected void aboutToBeReconciled()
Default implementation is to do nothing.
protected void initialProcess()
protected void forceReconciling()
protected void startReconciling()
protected void reconcilerReset()
protected boolean isRunningInReconcilerThread()
true
if running in this reconciler's background thread
Copyright (c) 2000, 2015 Eclipse Contributors and others. All rights reserved.Guidelines for using Eclipse APIs.