use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method updateAnnotationPainter.
/**
* Updates the annotation painter.
* @since 3.0
*/
private void updateAnnotationPainter() {
if (fAnnotationPainter == null)
return;
fAnnotationPainter.paint(IPainter.CONFIGURATION);
if (!fAnnotationPainter.isPaintingAnnotations()) {
if (fSourceViewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.removePainter(fAnnotationPainter);
}
if (fSourceViewer instanceof ITextViewerExtension4)
((ITextViewerExtension4) fSourceViewer).removeTextPresentationListener(fAnnotationPainter);
fAnnotationPainter.deactivate(true);
fAnnotationPainter.dispose();
fAnnotationPainter = null;
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class DefaultHyperlinkPresenter method highlightRegion.
private void highlightRegion(IRegion region) {
if (region.equals(fActiveRegion))
return;
repairRepresentation();
StyledText text = fTextViewer.getTextWidget();
if (text == null || text.isDisposed())
return;
// Invalidate region ==> apply text presentation
fActiveRegion = region;
if (fTextViewer instanceof ITextViewerExtension2)
((ITextViewerExtension2) fTextViewer).invalidateTextPresentation(region.getOffset(), region.getLength());
else
fTextViewer.invalidateTextPresentation();
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class ShowWhitespaceCharactersAction method installPainter.
/**
* Installs the painter on the editor.
*/
private void installPainter() {
Assert.isTrue(fWhitespaceCharPainter == null);
ITextViewer viewer = getTextViewer();
if (viewer instanceof ITextViewerExtension2) {
if (fStore != null) {
fWhitespaceCharPainter = new WhitespaceCharacterPainter(viewer, fShowLeadingSpaces, fShowEnclosedSpaces, fShowTrailingSpaces, fShowLeadingIdeographicSpaces, fShowEnclosedIdeographicSpaces, fShowTrailingIdeographicSpace, fShowLeadingTabs, fShowEnclosedTabs, fShowTrailingTabs, fShowCarriageReturn, fShowLineFeed, fAlpha);
} else {
fWhitespaceCharPainter = new WhitespaceCharacterPainter(viewer);
}
((ITextViewerExtension2) viewer).addPainter(fWhitespaceCharPainter);
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method showMatchingCharacters.
/**
* Enables showing of matching characters.
*/
private void showMatchingCharacters() {
if (fMatchingCharacterPainter == null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
fMatchingCharacterPainter = new MatchingCharacterPainter(fSourceViewer, fCharacterPairMatcher);
fMatchingCharacterPainter.setColor(getColor(fMatchingCharacterPainterColorKey));
fMatchingCharacterPainter.setHighlightCharacterAtCaretLocation(isCharacterAtCaretLocationShown());
fMatchingCharacterPainter.setHighlightEnclosingPeerCharacters(areEnclosingPeerCharactersShown());
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.addPainter(fMatchingCharacterPainter);
}
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method hideMatchingCharacters.
/**
* Disables showing of matching characters.
*/
private void hideMatchingCharacters() {
if (fMatchingCharacterPainter != null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.removePainter(fMatchingCharacterPainter);
fMatchingCharacterPainter.deactivate(true);
fMatchingCharacterPainter.dispose();
fMatchingCharacterPainter = null;
}
}
}
Aggregations