use of org.eclipse.jface.text.MarginPainter in project eclipse.platform.text by eclipse.
the class SourceViewerDecorationSupport method showMargin.
/**
* Shows the margin.
*/
private void showMargin() {
if (fMarginPainter == null) {
if (fSourceViewer instanceof ITextViewerExtension2) {
fMarginPainter = new MarginPainter(fSourceViewer);
fMarginPainter.setMarginRulerColor(getColor(fMarginPainterColorKey));
if (fPreferenceStore != null)
fMarginPainter.setMarginRulerColumn(fPreferenceStore.getInt(fMarginPainterColumnKey));
ITextViewerExtension2 extension = (ITextViewerExtension2) fSourceViewer;
extension.addPainter(fMarginPainter);
}
}
}
use of org.eclipse.jface.text.MarginPainter in project xtext-xtend by eclipse.
the class XtendFormatterPreview method forEmbeddedEditor.
public XtendFormatterPreview forEmbeddedEditor(EmbeddedEditor editorHandle) {
if (this.editorHandle != null) {
throw new IllegalStateException("This formatter preview is already binded to an embedet editor");
}
this.editorHandle = editorHandle;
this.modelAccess = editorHandle.createPartialEditor();
this.marginPainter = new MarginPainter(editorHandle.getViewer());
final RGB rgb = PreferenceConverter.getColor(preferenceStoreAccess.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR);
marginPainter.setMarginRulerColor(EditorUtils.colorFromRGB(rgb));
editorHandle.getViewer().addPainter(marginPainter);
return this;
}
Aggregations