Search in sources :

Example 6 with ITextViewerExtension2

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;
    }
}
Also used : ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2) ITextViewerExtension4(org.eclipse.jface.text.ITextViewerExtension4)

Example 7 with ITextViewerExtension2

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();
}
Also used : ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2) StyledText(org.eclipse.swt.custom.StyledText)

Example 8 with ITextViewerExtension2

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);
    }
}
Also used : ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2) ITextViewer(org.eclipse.jface.text.ITextViewer) WhitespaceCharacterPainter(org.eclipse.jface.text.WhitespaceCharacterPainter)

Example 9 with ITextViewerExtension2

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);
        }
    }
}
Also used : MatchingCharacterPainter(org.eclipse.jface.text.source.MatchingCharacterPainter) ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2)

Example 10 with ITextViewerExtension2

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;
        }
    }
}
Also used : ITextViewerExtension2(org.eclipse.jface.text.ITextViewerExtension2)

Aggregations

ITextViewerExtension2 (org.eclipse.jface.text.ITextViewerExtension2)14 ITextViewer (org.eclipse.jface.text.ITextViewer)2 ITextViewerExtension4 (org.eclipse.jface.text.ITextViewerExtension4)2 Annotation (org.eclipse.jface.text.source.Annotation)2 AnnotationPainter (org.eclipse.jface.text.source.AnnotationPainter)2 IAnnotationAccess (org.eclipse.jface.text.source.IAnnotationAccess)2 ISourceViewerExtension5 (org.eclipse.jface.text.source.ISourceViewerExtension5)2 MatchingCharacterPainter (org.eclipse.jface.text.source.MatchingCharacterPainter)2 CursorLinePainter (org.eclipse.jface.text.CursorLinePainter)1 MarginPainter (org.eclipse.jface.text.MarginPainter)1 WhitespaceCharacterPainter (org.eclipse.jface.text.WhitespaceCharacterPainter)1 SourceViewer (org.eclipse.jface.text.source.SourceViewer)1 AbstractInlinedAnnotation (org.eclipse.jface.text.source.inlined.AbstractInlinedAnnotation)1 LineContentAnnotation (org.eclipse.jface.text.source.inlined.LineContentAnnotation)1 LineHeaderAnnotation (org.eclipse.jface.text.source.inlined.LineHeaderAnnotation)1 StyledText (org.eclipse.swt.custom.StyledText)1 Color (org.eclipse.swt.graphics.Color)1