Search in sources :

Example 1 with MarginPainter

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

Example 2 with MarginPainter

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

Aggregations

MarginPainter (org.eclipse.jface.text.MarginPainter)2 ITextViewerExtension2 (org.eclipse.jface.text.ITextViewerExtension2)1 RGB (org.eclipse.swt.graphics.RGB)1