I want to show a vertical line (print margin in eclipse wording) after 120 characters in my org.eclipse.xtext.ui.editor.embedded.EmbeddedEditor
. Is this supported somehow or is there some underlying editor available where I could create such a line?
Answer from greg-449s comment:
final EmbeddedEditor editor = ...;
editor.createPartialEditor();
MarginPainter marginPainter = new MarginPainter(editor.getViewer());
marginPainter.setMarginRulerColumn(120);
marginPainter.setMarginRulerColor(Display.getDefault().getSystemColor(SWT.COLOR_GRAY));
editor.getViewer().addPainter(marginPainter);
You have to set the color, otherwise the next call to paint()
will throw.