use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method showCursorLine.
/**
* Shows the cursor line.
*/
private void showCursorLine() {
if (fCursorLinePainter == null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
fCursorLinePainter = new CursorLinePainter(fSourceViewer);
fCursorLinePainter.setHighlightColor(getColor(fCursorLinePainterColorKey));
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.addPainter(fCursorLinePainter);
}
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method hideCursorLine.
/**
* Hides the cursor line.
*/
private void hideCursorLine() {
if (fCursorLinePainter != null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.removePainter(fCursorLinePainter);
fCursorLinePainter.deactivate(true);
fCursorLinePainter.dispose();
fCursorLinePainter = null;
}
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class CodeMiningDemo method addAnnotationPainter.
private static void addAnnotationPainter(ISourceViewer viewer) {
IAnnotationAccess annotationAccess = new IAnnotationAccess() {
@Override
public Object getType(Annotation annotation) {
return annotation.getType();
}
@Override
public boolean isMultiLine(Annotation annotation) {
return true;
}
@Override
public boolean isTemporary(Annotation annotation) {
return true;
}
};
AnnotationPainter painter = new AnnotationPainter(viewer, annotationAccess);
((ITextViewerExtension2) viewer).addPainter(painter);
// Register this annotation painter as CodeMining annotation painter.
((ISourceViewerExtension5) viewer).setCodeMiningAnnotationPainter(painter);
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project eclipse.platform.text by eclipse.
the class InlinedAnnotationDemo method createAnnotationPainter.
/**
* Create annotation painter.
*
* @param viewer
* the viewer.
* @return annotation painter.
*/
private static AnnotationPainter createAnnotationPainter(ISourceViewer viewer) {
IAnnotationAccess annotationAccess = new IAnnotationAccess() {
@Override
public Object getType(Annotation annotation) {
return annotation.getType();
}
@Override
public boolean isMultiLine(Annotation annotation) {
return true;
}
@Override
public boolean isTemporary(Annotation annotation) {
return true;
}
};
AnnotationPainter painter = new AnnotationPainter(viewer, annotationAccess);
((ITextViewerExtension2) viewer).addPainter(painter);
return painter;
}
Aggregations