public class SemanticHighlightingPresenter
extends java.lang.Object
implements org.eclipse.jface.text.ITextPresentationListener, org.eclipse.jface.text.ITextInputListener, org.eclipse.jface.text.IDocumentListener
Red (tfeng) |
Red (tfeng) |
Constructor and Description |
---|
SemanticHighlightingPresenter() |
Modifier and Type | Method and Description |
---|---|
void |
addAllPositions(java.util.List<SemanticHighlightingReconciler.HighlightedPosition> list)
Adds all current positions to the given list.
|
void |
applyTextPresentation(org.eclipse.jface.text.TextPresentation textPresentation)
This method is called when a text presentation is about to be applied to
the text viewer.
|
SemanticHighlightingReconciler.HighlightedPosition |
createHighlightedPosition(int offset,
int length,
SemanticHighlightingReconciler.HighlightingStyle highlighting)
Creates and returns a new highlighted position with the given offset, length and highlighting.
|
org.eclipse.jface.text.TextPresentation |
createPresentation(java.util.List<?> addedPositions,
java.util.List<?> removedPositions)
Create a text presentation in the background.
|
java.lang.Runnable |
createUpdateRunnable(org.eclipse.jface.text.TextPresentation textPresentation,
java.util.List<SemanticHighlightingReconciler.HighlightedPosition> addedPositions,
java.util.List<SemanticHighlightingReconciler.HighlightedPosition> removedPositions)
Create a runnable for updating the presentation.
|
void |
documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
The manipulation described by the document event will be performed.
|
void |
documentChanged(org.eclipse.jface.text.DocumentEvent event)
The manipulation described by the document event has been performed.
|
void |
highlightingStyleChanged(SemanticHighlightingReconciler.HighlightingStyle highlighting)
Invalidate text presentation of positions with the given highlighting.
|
void |
inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput)
Called before the input document is replaced.
|
void |
inputDocumentChanged(org.eclipse.jface.text.IDocument oldInput,
org.eclipse.jface.text.IDocument newInput)
Called after the input document has been replaced.
|
void |
install(org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer sourceViewer,
org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler backgroundPresentationReconciler)
Install this presenter on the given source viewer and background presentation
reconciler.
|
boolean |
isCanceled()
Test whether the current reconcile is canceled.
|
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,
SemanticHighlightingReconciler.HighlightedPosition[] addedPositions,
SemanticHighlightingReconciler.HighlightedPosition[] removedPositions)
Invalidate the presentation of the positions based on the given added positions and the existing deleted positions.
|
public void addAllPositions(java.util.List<SemanticHighlightingReconciler.HighlightedPosition> list)
NOTE: Called from background thread.
list
- The listpublic void applyTextPresentation(org.eclipse.jface.text.TextPresentation textPresentation)
applyTextPresentation
in interface org.eclipse.jface.text.ITextPresentationListener
textPresentation
- the current text presentationpublic SemanticHighlightingReconciler.HighlightedPosition createHighlightedPosition(int offset, int length, SemanticHighlightingReconciler.HighlightingStyle highlighting)
NOTE: Also called from background thread.
offset
- The offsetlength
- The lengthhighlighting
- The highlightingpublic org.eclipse.jface.text.TextPresentation createPresentation(java.util.List<?> addedPositions, java.util.List<?> 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<SemanticHighlightingReconciler.HighlightedPosition> addedPositions, java.util.List<SemanticHighlightingReconciler.HighlightedPosition> removedPositions)
NOTE: Called from background thread.
textPresentation
- the text presentationaddedPositions
- the added positionsremovedPositions
- the removed positionsnull
, if reconciliation should be canceledpublic void documentAboutToBeChanged(org.eclipse.jface.text.DocumentEvent event)
documentAboutToBeChanged
in interface org.eclipse.jface.text.IDocumentListener
event
- the document event describing the document changepublic void documentChanged(org.eclipse.jface.text.DocumentEvent event)
documentChanged
in interface org.eclipse.jface.text.IDocumentListener
event
- the document event describing the document changepublic void highlightingStyleChanged(SemanticHighlightingReconciler.HighlightingStyle highlighting)
highlighting
- The highlightingpublic void inputDocumentAboutToBeChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
inputDocumentAboutToBeChanged
in interface org.eclipse.jface.text.ITextInputListener
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input documentpublic void inputDocumentChanged(org.eclipse.jface.text.IDocument oldInput, org.eclipse.jface.text.IDocument newInput)
inputDocumentChanged
in interface org.eclipse.jface.text.ITextInputListener
oldInput
- the text viewer's previous input documentnewInput
- the text viewer's new input documentpublic void install(org.eclipse.jdt.internal.ui.javaeditor.JavaSourceViewer sourceViewer, org.eclipse.jdt.internal.ui.text.JavaPresentationReconciler backgroundPresentationReconciler)
sourceViewer
- the source viewerbackgroundPresentationReconciler
- the background presentation reconciler,
can be null
, in that case createPresentation(List, List)
should not be calledpublic boolean isCanceled()
public void setCanceled(boolean isCanceled)
isCanceled
- true
iff the current reconcile is canceledpublic void uninstall()
public void updatePresentation(org.eclipse.jface.text.TextPresentation textPresentation, SemanticHighlightingReconciler.HighlightedPosition[] addedPositions, SemanticHighlightingReconciler.HighlightedPosition[] 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 positions