Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 181168
Collapse All | Expand All

(-)compare/org/eclipse/compare/internal/MergeSourceViewer.java (+37 lines)
Lines 17-22 Link Here
17
import org.eclipse.compare.ICompareContainer;
17
import org.eclipse.compare.ICompareContainer;
18
import org.eclipse.core.commands.operations.*;
18
import org.eclipse.core.commands.operations.*;
19
import org.eclipse.jface.action.*;
19
import org.eclipse.jface.action.*;
20
import org.eclipse.jface.preference.IPreferenceStore;
21
import org.eclipse.jface.preference.PreferenceConverter;
20
import org.eclipse.jface.text.*;
22
import org.eclipse.jface.text.*;
21
import org.eclipse.jface.text.source.*;
23
import org.eclipse.jface.text.source.*;
22
import org.eclipse.jface.util.IPropertyChangeListener;
24
import org.eclipse.jface.util.IPropertyChangeListener;
Lines 143-154 Link Here
143
		StyledText te= getTextWidget();
145
		StyledText te= getTextWidget();
144
		if (te != null)
146
		if (te != null)
145
			te.setFont(font);
147
			te.setFont(font);
148
		if (fLineNumberColumn != null)
149
			fLineNumberColumn.setFont(font);
146
	}
150
	}
147
	
151
	
148
	public void setBackgroundColor(Color color) {
152
	public void setBackgroundColor(Color color) {
149
		StyledText te= getTextWidget();
153
		StyledText te= getTextWidget();
150
		if (te != null)
154
		if (te != null)
151
			te.setBackground(color);
155
			te.setBackground(color);
156
		if (fLineNumberColumn != null)
157
			fLineNumberColumn.setBackground(color);
152
	}
158
	}
153
	
159
	
154
	public void setEnabled(boolean enabled) {
160
	public void setEnabled(boolean enabled) {
Lines 533-538 Link Here
533
			if (b != fShowLineNumber){
539
			if (b != fShowLineNumber){
534
				toggleLineNumberRuler();	
540
				toggleLineNumberRuler();	
535
			}
541
			}
542
		} else if (key.equals(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR)) {
543
			updateLineNumberColumnPresentation(true);
536
		}
544
		}
537
	}
545
	}
538
546
Lines 552-563 Link Here
552
			} else {
560
			} else {
553
				if(fLineNumberColumn==null){
561
				if(fLineNumberColumn==null){
554
					fLineNumberColumn = new LineNumberRulerColumn();
562
					fLineNumberColumn = new LineNumberRulerColumn();
563
					updateLineNumberColumnPresentation(false);
555
				}
564
				}
556
				c.addDecorator(0, fLineNumberColumn);
565
				c.addDecorator(0, fLineNumberColumn);
557
			}
566
			}
558
		}
567
		}
559
	}
568
	}
560
569
570
	private void updateLineNumberColumnPresentation(boolean refresh) {
571
		if (fLineNumberColumn == null)
572
			return;
573
		RGB rgb=  getColorFromStore(EditorsUI.getPreferenceStore(), AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR);
574
		if (rgb == null)
575
			rgb= new RGB(0, 0, 0);
576
		ISharedTextColors sharedColors= getSharedColors();
577
		fLineNumberColumn.setForeground(sharedColors.getColor(rgb));
578
		if (refresh) {
579
			fLineNumberColumn.redraw();
580
		}
581
	}
582
	
583
	private ISharedTextColors getSharedColors() {
584
		return EditorsUI.getSharedTextColors();
585
	}
586
	
587
	private RGB getColorFromStore(IPreferenceStore store, String key) {
588
		RGB rgb= null;
589
		if (store.contains(key)) {
590
			if (store.isDefault(key))
591
				rgb= PreferenceConverter.getDefaultColor(store, key);
592
			else
593
				rgb= PreferenceConverter.getColor(store, key);
594
		}
595
		return rgb;
596
	}
597
561
	/**
598
	/**
562
	 * Toggles line number ruler column.
599
	 * Toggles line number ruler column.
563
	 */
600
	 */

Return to bug 181168