Пример #1
0
  /**
   * @param parent
   * @param ruler
   * @param styles
   */
  public DiffViewer(Composite parent, IVerticalRuler ruler, int styles) {
    super(parent, ruler, styles);
    setDocument(new Document());
    SourceViewerDecorationSupport support =
        new SourceViewerDecorationSupport(this, null, null, EditorsUI.getSharedTextColors());
    support.setCursorLinePainterPreferenceKeys(
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
        AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR);
    support.install(EditorsUI.getPreferenceStore());
    if (ruler instanceof CompositeRuler) {
      lineNumberRuler = new LineNumberRulerColumn();
      ((CompositeRuler) ruler).addDecorator(0, lineNumberRuler);
    }
    initListeners();
    getControl()
        .addDisposeListener(
            new DisposeListener() {

              public void widgetDisposed(DisposeEvent e) {
                EditorsUI.getPreferenceStore().removePropertyChangeListener(editorPrefListener);
                PlatformUI.getWorkbench()
                    .getThemeManager()
                    .removePropertyChangeListener(themeListener);
                colors.dispose();
              }
            });
    refreshDiffColors();
    styleViewer();
  }
 @Override
 protected void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
   super.configureSourceViewerDecorationSupport(support);
   if (AttemptToChangeCurrentLineColorAccordingToTheme) {
     adjustCurrentLineColor(getTheme());
     support.setCursorLinePainterPreferenceKeys(
         AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE,
         PreferenceConstants.CUSTOM_CURRENT_LINE_COLOR);
   }
 }
Пример #3
0
 private void configureSourceViewerDecorationSupport(SourceViewerDecorationSupport support) {
   for (Object pref : fAnnotationPreferences.getAnnotationPreferences()) {
     support.setAnnotationPreference((AnnotationPreference) pref);
   }
   support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
 }