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;
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project webtools.sourceediting by eclipse.
the class StructuredTextEditor method updateHoverBehavior.
/*
* Update the hovering behavior depending on the preferences.
*/
private void updateHoverBehavior() {
SourceViewerConfiguration configuration = getSourceViewerConfiguration();
String[] types = configuration.getConfiguredContentTypes(getSourceViewer());
ISourceViewer sourceViewer = getSourceViewer();
if (sourceViewer == null)
return;
for (int i = 0; i < types.length; i++) {
String t = types[i];
if (sourceViewer instanceof ITextViewerExtension2) {
// Remove existing hovers
((ITextViewerExtension2) sourceViewer).removeTextHovers(t);
int[] stateMasks = configuration.getConfiguredTextHoverStateMasks(getSourceViewer(), t);
if (stateMasks != null) {
for (int j = 0; j < stateMasks.length; j++) {
int stateMask = stateMasks[j];
ITextHover textHover = configuration.getTextHover(sourceViewer, t, stateMask);
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, stateMask);
}
} else {
ITextHover textHover = configuration.getTextHover(sourceViewer, t);
((ITextViewerExtension2) sourceViewer).setTextHover(textHover, t, ITextViewerExtension2.DEFAULT_HOVER_STATE_MASK);
}
} else
sourceViewer.setTextHover(configuration.getTextHover(sourceViewer, t), t);
}
}
use of org.eclipse.jface.text.ITextViewerExtension2 in project webtools.sourceediting by eclipse.
the class SemanticHighlightingPresenter method invalidateTextPresentation.
/**
* Invalidate text presentation of all positions.
*/
private void invalidateTextPresentation() {
if (fSourceViewer instanceof ITextViewerExtension2) {
final ITextViewerExtension2 viewer = (ITextViewerExtension2) fSourceViewer;
for (int i = 0, n = fPositions.size(); i < n; i++) {
Position position = (Position) fPositions.get(i);
viewer.invalidateTextPresentation(position.getOffset(), position.getLength());
}
} else {
fSourceViewer.invalidateTextPresentation();
}
}
Aggregations