|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.eclipse.core.runtime.PlatformObject org.eclipse.core.internal.jobs.InternalJob org.eclipse.core.runtime.jobs.Job org.eclipse.xtext.ui.editor.reconciler.XtextReconciler
public class XtextReconciler
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.
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)
Returns whether this job belongs to the given family. |
protected ReplaceRegion |
getAndResetReplaceRegion()
|
org.eclipse.jface.text.reconciler.IReconcilingStrategy |
getReconcilingStrategy(java.lang.String contentType)
Returns the reconciling strategy registered with the reconciler for the specified content type. |
protected void |
handleInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput)
|
void |
install(org.eclipse.jface.text.ITextViewer textViewer)
Installs the reconciler on the given text viewer. |
protected void |
pause()
|
protected void |
resume()
|
protected org.eclipse.core.runtime.IStatus |
run(org.eclipse.core.runtime.IProgressMonitor monitor)
Executes this job. |
void |
setDelay(int delay)
|
void |
setReconcilingStrategy(org.eclipse.jface.text.reconciler.IReconcilingStrategy strategy)
|
void |
uninstall()
Removes the reconciler from the text viewer it has previously been installed on. |
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, toString, wakeUp, wakeUp, yieldRule |
Methods inherited from class org.eclipse.core.internal.jobs.InternalJob |
---|
compareTo |
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 |
---|
@Inject public XtextReconciler(XtextDocumentReconcileStrategy strategy)
Method Detail |
---|
public org.eclipse.jface.text.reconciler.IReconcilingStrategy getReconcilingStrategy(java.lang.String contentType)
org.eclipse.jface.text.reconciler.IReconciler
getReconcilingStrategy
in interface org.eclipse.jface.text.reconciler.IReconciler
contentType
- the content type for which to determine the reconciling strategy
null
if there is no such strategypublic void setReconcilingStrategy(org.eclipse.jface.text.reconciler.IReconcilingStrategy strategy)
public void install(org.eclipse.jface.text.ITextViewer textViewer)
org.eclipse.jface.text.reconciler.IReconciler
uninstall
is called.
install
in interface org.eclipse.jface.text.reconciler.IReconciler
textViewer
- the viewer on which the reconciler is installedpublic void uninstall()
org.eclipse.jface.text.reconciler.IReconciler
uninstall
in interface org.eclipse.jface.text.reconciler.IReconciler
protected void handleInputDocumentChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
protected void pause()
protected void resume()
public void setDelay(int delay)
public boolean belongsTo(java.lang.Object family)
org.eclipse.core.runtime.jobs.Job
Clients may override this method. This default implementation always returns
false
. Overriding implementations must return false
for families they do not recognize.
belongsTo
in class org.eclipse.core.runtime.jobs.Job
family
- the job family identifier
true
if this job belongs to the given family, and
false
otherwise.protected org.eclipse.core.runtime.IStatus run(org.eclipse.core.runtime.IProgressMonitor monitor)
org.eclipse.core.runtime.jobs.Job
The provided monitor can be used to report progress and respond to
cancellation. If the progress monitor has been canceled, the job
should finish its execution at the earliest convenience and return a result
status of severity IStatus.CANCEL
. The singleton
cancel status Status.CANCEL_STATUS
can be used for
this purpose. The monitor is only valid for the duration of the invocation
of this method.
This method must not be called directly by clients. Clients should call
schedule
, which will in turn cause this method to be called.
Jobs can optionally finish their execution asynchronously (in another thread) by
returning a result status of Job.ASYNC_FINISH
. Jobs that finish
asynchronously must specify the execution thread by calling
setThread
, and must indicate when they are finished by calling
the method done
.
run
in class org.eclipse.core.runtime.jobs.Job
monitor
- the monitor to be used for reporting progress and
responding to cancelation. The monitor is never null
null
Job.ASYNC_FINISH
,
Job.done(IStatus)
protected ReplaceRegion getAndResetReplaceRegion()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |