public class HighlightingPresenter extends 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(List<AttributedPosition> list)
Adds all current positions to the given list.
|
void |
applyTextPresentation(org.eclipse.jface.text.TextPresentation textPresentation) |
protected int |
computeIndexAfterOffset(List<AttributedPosition> positions,
int offset)
Returns the index of the first position with an offset greater than the given offset.
|
protected int |
computeIndexAtOffset(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(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(List<AttributedPosition> addedPositions,
List<AttributedPosition> removedPositions)
Create a text presentation in the background.
|
Runnable |
createSimpleUpdateRunnable() |
Runnable |
createUpdateRunnable(org.eclipse.jface.text.TextPresentation textPresentation,
List<AttributedPosition> addedPositions,
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(List<AttributedPosition> list)
NOTE: Called from background thread.
list - The listpublic org.eclipse.jface.text.TextPresentation createPresentation(List<AttributedPosition> addedPositions, List<AttributedPosition> removedPositions)
NOTE: Called from background thread.
addedPositions - the added positionsremovedPositions - the removed positionsnull, if reconciliation should be canceledpublic Runnable createUpdateRunnable(org.eclipse.jface.text.TextPresentation textPresentation, List<AttributedPosition> addedPositions, List<AttributedPosition> removedPositions)
NOTE: Called from background thread.
textPresentation - the text presentationaddedPositions - the added positionsremovedPositions - the removed positionsnull, if reconciliation should be canceledpublic 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(List<AttributedPosition> positions, int offset)
positions - the positions, must be ordered by offset and must not overlapoffset - the offsetprotected int computeIndexEndingAtOrEnclosingOffset(List<AttributedPosition> positions, int offset)
positions - the positions, must be ordered by offset and must not overlapoffset - the offsetprotected int computeIndexAtOffset(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.ITextPresentationListenerpublic void inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput)
inputDocumentAboutToBeChanged in interface org.eclipse.jface.text.ITextInputListenerpublic void inputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput)
inputDocumentChanged in interface org.eclipse.jface.text.ITextInputListenerpublic void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
documentAboutToBeChanged in interface org.eclipse.jface.text.IDocumentListenerpublic void documentChanged(org.eclipse.jface.text.DocumentEvent event)
documentChanged in interface org.eclipse.jface.text.IDocumentListenerpublic 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 highlightingCopyright © 2016. All Rights Reserved.