private void styleViewer() {
    IPreferenceStore store = EditorsUI.getPreferenceStore();
    Color foreground = null;
    if (!store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND_SYSTEM_DEFAULT))
      foreground = getEditorColor(AbstractTextEditor.PREFERENCE_COLOR_FOREGROUND);

    Color background = null;
    if (!store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND_SYSTEM_DEFAULT))
      background = getEditorColor(AbstractTextEditor.PREFERENCE_COLOR_BACKGROUND);

    Color selectionForeground = null;
    if (!store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND_SYSTEM_DEFAULT))
      selectionForeground =
          getEditorColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_FOREGROUND);

    Color selectionBackground = null;
    if (!store.getBoolean(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND_SYSTEM_DEFAULT))
      selectionBackground =
          getEditorColor(AbstractTextEditor.PREFERENCE_COLOR_SELECTION_BACKGROUND);

    StyledText text = getTextWidget();
    text.setForeground(foreground);
    text.setBackground(background);
    text.setSelectionForeground(selectionForeground);
    text.setSelectionBackground(selectionBackground);
    text.setFont(JFaceResources.getFont(JFaceResources.TEXT_FONT));
    if (lineNumberRuler != null) {
      lineNumberRuler.setFont(text.getFont());
      lineNumberRuler.setForeground(foreground);
      lineNumberRuler.setBackground(background);
    }
  }
 private void updateLineNumberColumnPresentation(boolean refresh) {
   if (fLineNumberColumn == null) return;
   RGB rgb =
       getColorFromStore(
           EditorsUI.getPreferenceStore(),
           AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR);
   if (rgb == null) rgb = new RGB(0, 0, 0);
   ISharedTextColors sharedColors = getSharedColors();
   fLineNumberColumn.setForeground(sharedColors.getColor(rgb));
   if (refresh) {
     fLineNumberColumn.redraw();
   }
 }
 public void setFont(Font font) {
   StyledText te = getSourceViewer().getTextWidget();
   if (te != null) te.setFont(font);
   if (fLineNumberColumn != null) {
     fLineNumberColumn.setFont(font);
     layoutViewer();
   }
 }
 public void setBackgroundColor(Color color) {
   StyledText te = getSourceViewer().getTextWidget();
   if (te != null) te.setBackground(color);
   if (fLineNumberColumn != null) fLineNumberColumn.setBackground(color);
 }