use of org.eclipse.jface.text.ITextViewerExtension2 in project xtext-eclipse by eclipse.
the class DefaultContentViewer method configureSourceViewer.
@Override
protected void configureSourceViewer(ISourceViewer sourceViewer) {
sourceViewer.setEditable(false);
sourceViewer.configure(sourceViewerConfiguration);
if (sourceViewer instanceof ITextViewerExtension6) {
ITextViewerExtension6 textViewerExtension6 = (ITextViewerExtension6) sourceViewer;
textViewerExtension6.setHyperlinkDetectors(null, sourceViewerConfiguration.getHyperlinkStateMask(sourceViewer));
}
if (sourceViewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 textViewerExtension2 = (ITextViewerExtension2) sourceViewer;
String[] configuredContentTypes = sourceViewerConfiguration.getConfiguredContentTypes(sourceViewer);
for (String contentType : configuredContentTypes) {
textViewerExtension2.removeTextHovers(contentType);
}
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class BracketMatchingReconciler method install.
@Override
public void install(ITextViewer textViewer) {
if (textViewer instanceof ITextViewerExtension2 && textViewer instanceof SourceViewer) {
fSourceViewer = (SourceViewer) textViewer;
fMatchingCharacterPainter = new MatchingCharacterPainter(fSourceViewer, fCharacterPairMatcher);
fMatchingCharacterPainter.setColor(new Color(Display.getCurrent(), fBoxingRGB));
fMatchingCharacterPainter.setHighlightCharacterAtCaretLocation(true);
fMatchingCharacterPainter.setHighlightEnclosingPeerCharacters(true);
fSourceViewer.addPainter(fMatchingCharacterPainter);
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class ShowWhitespaceCharactersAction method uninstallPainter.
/**
* Remove the painter from the current editor.
*/
private void uninstallPainter() {
if (fWhitespaceCharPainter == null)
return;
ITextViewer viewer = getTextViewer();
if (viewer instanceof ITextViewerExtension2)
((ITextViewerExtension2) viewer).removePainter(fWhitespaceCharPainter);
fWhitespaceCharPainter.deactivate(true);
fWhitespaceCharPainter = null;
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method showAnnotations.
/**
* Enables annotations in the source viewer for the given annotation type.
*
* @param annotationType the annotation type
* @param updatePainter if <code>true</code> update the annotation painter
* @since 3.0
*/
private void showAnnotations(Object annotationType, boolean updatePainter) {
if (fSourceViewer instanceof ITextViewerExtension2) {
if (fAnnotationPainter == null) {
fAnnotationPainter = createAnnotationPainter();
if (fSourceViewer instanceof ITextViewerExtension4)
((ITextViewerExtension4) fSourceViewer).addTextPresentationListener(fAnnotationPainter);
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.addPainter(fAnnotationPainter);
if (fSourceViewer instanceof ISourceViewerExtension5)
((ISourceViewerExtension5) fSourceViewer).setCodeMiningAnnotationPainter(fAnnotationPainter);
}
fAnnotationPainter.setAnnotationTypeColor(annotationType, getAnnotationTypeColor(annotationType));
Object decorationType = getAnnotationDecorationType(annotationType);
if (decorationType != null)
fAnnotationPainter.addAnnotationType(annotationType, decorationType);
else
fAnnotationPainter.addHighlightAnnotationType(annotationType);
if (updatePainter)
updateAnnotationPainter();
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method hideMargin.
/**
* Hides the margin.
*/
private void hideMargin() {
if (fMarginPainter != null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.removePainter(fMarginPainter);
fMarginPainter.deactivate(true);
fMarginPainter.dispose();
fMarginPainter = null;
}
}
}
Aggregations