public class HighlightingPresenter
extends java.lang.Object
implements org.eclipse.jface.text.ITextPresentationListener, org.eclipse.jface.text.ITextInputListener, org.eclipse.jface.text.IDocumentListener
Constructor and Description |
---|
HighlightingPresenter() |
Modifier and Type | Method and Description |
---|---|
void |
addAllPositions(java.util.List<AttributedPosition> list)
Adds all current positions to the given list.
|
void |
applyTextPresentation(org.eclipse.jface.text.TextPresentation textPresentation) |
protected int |
computeIndexAfterOffset(java.util.List<AttributedPosition> positions,
int offset)
Returns the index of the first position with an offset greater than the given offset.
|
protected int |
computeIndexAtOffset(java.util.List<AttributedPosition> positions,
int offset)
Returns the index of the first position with an offset equal or greater than the given offset.
|
protected int |
computeIndexEndingAtOrEnclosingOffset(java.util.List<AttributedPosition> positions,
int offset)
Returns the index of the first position with an offset equal or greater than the given offset.
|
AttributedPosition |
createHighlightedPosition(int offset,
int length,
org.eclipse.jface.text.TextAttribute highlighting)
Creates and returns a new highlighted position with the given offset, length and highlighting.
|
org.eclipse.jface.text.TextPresentation |
createPresentation(java.util.List<AttributedPosition> addedPositions,
java.util.List<AttributedPosition> removedPositions)
Create a text presentation in the background.
|
java.lang.Runnable |
createSimpleUpdateRunnable() |
java.lang.Runnable |
createUpdateRunnable(org.eclipse.jface.text.TextPresentation textPresentation,
java.util.List<AttributedPosition> addedPositions,
java.util.List<AttributedPosition> removedPositions)
Create a runnable for updating the presentation.
|
void |
documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event) |
void |
documentChanged(org.eclipse.jface.text.DocumentEvent event) |
void |
highlightingStyleChanged(org.eclipse.jface.text.TextAttribute highlighting)
Invalidate text presentation of positions with the given highlighting.
|
void |
inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput) |
void |
inputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput) |
void |
install(XtextSourceViewer sourceViewer,
XtextPresentationReconciler backgroundPresentationReconciler)
Install this presenter on the given source viewer and background presentation reconciler.
|
boolean |
isCanceled() |
void |
setCanceled(boolean isCanceled)
Set whether or not the current reconcile is canceled.
|
void |
uninstall()
Uninstall this presenter.
|
void |
updatePresentation(org.eclipse.jface.text.TextPresentation textPresentation,
AttributedPosition[] addedPositions,
AttributedPosition[] removedPositions)
Invalidate the presentation of the positions based on the given added positions and the existing deleted
positions.
|
public AttributedPosition createHighlightedPosition(int offset, int length, org.eclipse.jface.text.TextAttribute highlighting)
NOTE: Also called from background thread.
offset
- The offsetlength
- The lengthhighlighting
- The highlightingpublic void addAllPositions(java.util.List<AttributedPosition> list)
NOTE: Called from background thread.
list
- The listpublic org.eclipse.jface.text.TextPresentation createPresentation(java.util.List<AttributedPosition> addedPositions, java.util.List<AttributedPosition> removedPositions)
NOTE: Called from background thread.
addedPositions
- the added positionsremovedPositions
- the removed positionsnull
, if reconciliation should be canceledpublic java.lang.Runnable createUpdateRunnable(org.eclipse.jface.text.TextPresentation textPresentation, java.util.List<AttributedPosition> addedPositions, java.util.List<AttributedPosition> removedPositions)
NOTE: Called from background thread.
textPresentation
- the text presentationaddedPositions
- the added positionsremovedPositions
- the removed positionsnull
, if reconciliation should be canceledpublic java.lang.Runnable createSimpleUpdateRunnable()
public void updatePresentation(org.eclipse.jface.text.TextPresentation textPresentation, AttributedPosition[] addedPositions, AttributedPosition[] removedPositions)
NOTE: Indirectly called from background thread by UI runnable.
textPresentation
- the text presentation or null
, if the presentation should computed in the UI threadaddedPositions
- the added positionsremovedPositions
- the removed positionsprotected int computeIndexAfterOffset(java.util.List<AttributedPosition> positions, int offset)
positions
- the positions, must be ordered by offset and must not overlapoffset
- the offsetprotected int computeIndexEndingAtOrEnclosingOffset(java.util.List<AttributedPosition> positions, int offset)
positions
- the positions, must be ordered by offset and must not overlapoffset
- the offsetprotected int computeIndexAtOffset(java.util.List<AttributedPosition> positions, int offset)
positions
- the positions, must be ordered by offset and must not overlapoffset
- the offsetpublic void applyTextPresentation(org.eclipse.jface.text.TextPresentation textPresentation)
applyTextPresentation
in interface org.eclipse.jface.text.ITextPresentationListener
public void inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
inputDocumentAboutToBeChanged
in interface org.eclipse.jface.text.ITextInputListener
public void inputDocumentChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
inputDocumentChanged
in interface org.eclipse.jface.text.ITextInputListener
public void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
documentAboutToBeChanged
in interface org.eclipse.jface.text.IDocumentListener
public void documentChanged(org.eclipse.jface.text.DocumentEvent event)
documentChanged
in interface org.eclipse.jface.text.IDocumentListener
public boolean isCanceled()
true
iff the current reconcile is canceled.
NOTE: Also called from background thread.
public void setCanceled(boolean isCanceled)
isCanceled
- true
iff the current reconcile is canceledpublic void install(XtextSourceViewer sourceViewer, XtextPresentationReconciler backgroundPresentationReconciler)
sourceViewer
- the source viewerbackgroundPresentationReconciler
- the background presentation reconciler, can be null
, in that case
createPresentation(List, List)
should not be calledpublic void uninstall()
public void highlightingStyleChanged(org.eclipse.jface.text.TextAttribute highlighting)
highlighting
- The highlighting