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 309660 | Differences between
and this patch

Collapse All | Expand All

(-)src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java (-1 / +4 lines)
Lines 372-377 Link Here
372
	private final String[][] fAppearanceColorListModel= new String[][] {
372
	private final String[][] fAppearanceColorListModel= new String[][] {
373
		{TextEditorMessages.TextEditorPreferencePage_lineNumberForegroundColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, null},
373
		{TextEditorMessages.TextEditorPreferencePage_lineNumberForegroundColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER_COLOR, null},
374
		{TextEditorMessages.TextEditorPreferencePage_currentLineHighlighColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, null},
374
		{TextEditorMessages.TextEditorPreferencePage_currentLineHighlighColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR, null},
375
		{TextEditorMessages.TextEditorPreferencePage_cursorColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CUSTOM_CURSOR_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURSOR_SYSTEM_DEFAULT},
375
		{TextEditorMessages.TextEditorPreferencePage_printMarginColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, null},
376
		{TextEditorMessages.TextEditorPreferencePage_printMarginColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR, null},
376
		{TextEditorMessages.TextEditorPreferencePage_findScopeColor, AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE, null},
377
		{TextEditorMessages.TextEditorPreferencePage_findScopeColor, AbstractTextEditor.PREFERENCE_COLOR_FIND_SCOPE, null},
377
		{TextEditorMessages.TextEditorPreferencePage_selectionForegroundColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR},
378
		{TextEditorMessages.TextEditorPreferencePage_selectionForegroundColor, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_COLOR, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR},
Lines 451-457 Link Here
451
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TEXT_DRAG_AND_DROP_ENABLED));
452
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TEXT_DRAG_AND_DROP_ENABLED));
452
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
453
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SHOW_TEXT_HOVER_AFFORDANCE));
453
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HOVER_ENRICH_MODE));
454
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_HOVER_ENRICH_MODE));
454
455
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CUSTOM_CURSOR_COLOR));
456
		overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURSOR_SYSTEM_DEFAULT));
457
		
455
		OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
458
		OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()];
456
		overlayKeys.toArray(keys);
459
		overlayKeys.toArray(keys);
457
		return new OverlayPreferenceStore(getPreferenceStore(), keys);
460
		return new OverlayPreferenceStore(getPreferenceStore(), keys);
(-)src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java (+1 lines)
Lines 144-147 Link Here
144
	public static String LinkedModeConfigurationBlock_labels_showIn;
144
	public static String LinkedModeConfigurationBlock_labels_showIn;
145
	public static String LinkedModeConfigurationBlock_color;
145
	public static String LinkedModeConfigurationBlock_color;
146
	public static String LinkedModeConfigurationBlock_linking_title;
146
	public static String LinkedModeConfigurationBlock_linking_title;
147
	public static String TextEditorPreferencePage_cursorColor;
147
}
148
}
(-)src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties (+1 lines)
Lines 44-49 Link Here
44
44
45
TextEditorPreferencePage_overwriteMode= Disable &overwrite typing mode
45
TextEditorPreferencePage_overwriteMode= Disable &overwrite typing mode
46
46
47
TextEditorPreferencePage_cursorColor= Cursor color
47
TextEditorPreferencePage_selectionForegroundColor= Selection foreground color
48
TextEditorPreferencePage_selectionForegroundColor= Selection foreground color
48
TextEditorPreferencePage_selectionBackgroundColor= Selection background color
49
TextEditorPreferencePage_selectionBackgroundColor= Selection background color
49
TextEditorPreferencePage_systemDefault= System De&fault
50
TextEditorPreferencePage_systemDefault= System De&fault
(-)src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java (+9 lines)
Lines 182-187 Link Here
182
	 */
182
	 */
183
	private final static String CURRENT_LINE_COLOR= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
183
	private final static String CURRENT_LINE_COLOR= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE_COLOR;
184
	/**
184
	/**
185
	 * Preference key for system default cursor.
186
	 */
187
	private final static String CURSOR_SYSTEM_DEFAULT = AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURSOR_SYSTEM_DEFAULT;
188
	/**
189
	 * Preference key for customized cursor color.
190
	 */
191
	private final static String CUSTOM_CURSOR_COLOR= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CUSTOM_CURSOR_COLOR;
192
	/**
185
	 * Preference key for showing print margin ruler.
193
	 * Preference key for showing print margin ruler.
186
	 */
194
	 */
187
	private final static String PRINT_MARGIN= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN;
195
	private final static String PRINT_MARGIN= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN;
Lines 421-426 Link Here
421
			support.setAnnotationPreference((AnnotationPreference) e.next());
429
			support.setAnnotationPreference((AnnotationPreference) e.next());
422
430
423
		support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
431
		support.setCursorLinePainterPreferenceKeys(CURRENT_LINE, CURRENT_LINE_COLOR);
432
		support.setCursorColorPreferenceKeys(CURSOR_SYSTEM_DEFAULT, CUSTOM_CURSOR_COLOR);
424
		support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
433
		support.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN);
425
		support.setSymbolicFontName(getFontPropertyPreferenceKey());
434
		support.setSymbolicFontName(getFontPropertyPreferenceKey());
426
	}
435
	}
(-)src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java (-1 / +23 lines)
Lines 68-73 Link Here
68
	public final static String EDITOR_CURRENT_LINE_COLOR= "currentLineColor"; //$NON-NLS-1$
68
	public final static String EDITOR_CURRENT_LINE_COLOR= "currentLineColor"; //$NON-NLS-1$
69
69
70
	/**
70
	/**
71
	 * A named preference that holds the custom color used for editor cursor. 
72
	 * (value <code>"customCursorColor"</code>).
73
	 * <p>
74
	 * The preference value is of type <code>String</code>. A RGB color value encoded as a string
75
	 * using class <code>PreferenceConverter</code>.
76
	 * </p>
77
	 * @see org.eclipse.jface.resource.StringConverter
78
	 * @see PreferenceConverter
79
	 */
80
	public final static String EDITOR_CUSTOM_CURSOR_COLOR= "customCursorColor"; //$NON-NLS-1$
81
	
82
	/**
83
	 * A named preference that controls whether uses system default cursor.
84
	 * (value <code>"cursorColor.SystemDefault"</code>).
85
	 * <p>
86
	 * The preference value is of type <code>Boolean</code>.
87
	 * </p>
88
	 */
89
	public final static String EDITOR_CURSOR_SYSTEM_DEFAULT= "cursorColor.SystemDefault"; //$NON-NLS-1$
90
	
91
	/**
71
	 * A named preference that holds the number of spaces used per tab in the text editor.
92
	 * A named preference that holds the number of spaces used per tab in the text editor.
72
	 * <p>
93
	 * <p>
73
	 * Value is of type <code>int</code>: positive int value specifying the number of
94
	 * Value is of type <code>int</code>: positive int value specifying the number of
Lines 498-504 Link Here
498
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE, false);
519
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.USE_ANNOTATIONS_PREFERENCE_PAGE, false);
499
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE, false);
520
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.USE_QUICK_DIFF_PREFERENCE_PAGE, false);
500
521
501
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true);
522
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE, true);		
523
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURSOR_SYSTEM_DEFAULT, true);
502
524
503
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
525
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH, 4);
504
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, false);
526
		store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, false);
(-)src/org/eclipse/ui/internal/texteditor/MonoColorIBeamCursor.java (+142 lines)
Added Link Here
1
/*******************************************************************************
2
 * Copyright (c) 2010 IBM Corporation and others.
3
 * All rights reserved. This program and the accompanying materials
4
 * are made available under the terms of the Eclipse Public License v1.0
5
 * which accompanies this distribution, and is available at
6
 * http://www.eclipse.org/legal/epl-v10.html
7
 *
8
 * Contributors:
9
 *     Daoen Pan <pan.daoen@consideo.com>
10
 *******************************************************************************/
11
package org.eclipse.ui.internal.texteditor;
12
13
import org.eclipse.swt.graphics.Cursor;
14
import org.eclipse.swt.graphics.ImageData;
15
import org.eclipse.swt.graphics.PaletteData;
16
import org.eclipse.swt.graphics.RGB;
17
import org.eclipse.swt.widgets.Display;
18
19
import org.eclipse.core.runtime.Assert;
20
21
import org.eclipse.ui.PlatformUI;
22
23
/**
24
 * Helper class to create and dispose a mono-color I-Beam cursor with 16x16 dimension.
25
 * 
26
 * The color of the cursor can be changed by the method <code>setRGB(RGB)</code>. The cursor is
27
 * returned with the method <code>getCursor()</code>.
28
 */
29
public class MonoColorIBeamCursor {
30
31
	private static byte[] ibeamShape= { (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
32
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
33
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
34
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)1, (byte)1,
35
			(byte)0, (byte)0, (byte)0, (byte)1, (byte)1, (byte)0,
36
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
37
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)1, (byte)0,
38
			(byte)1, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
39
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
40
			(byte)0, (byte)0, (byte)0, (byte)1, (byte)0, (byte)0,
41
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
42
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
43
			(byte)0, (byte)1, (byte)0, (byte)0, (byte)0, (byte)0,
44
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
45
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1,
46
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
47
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
48
			(byte)0, (byte)0, (byte)0, (byte)1, (byte)0, (byte)0,
49
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
50
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
51
			(byte)1, (byte)1, (byte)1, (byte)0, (byte)0, (byte)0,
52
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
53
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1,
54
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
55
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
56
			(byte)0, (byte)0, (byte)0, (byte)1, (byte)0, (byte)0,
57
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
58
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
59
			(byte)0, (byte)1, (byte)0, (byte)0, (byte)0, (byte)0,
60
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
61
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)1,
62
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
63
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
64
			(byte)0, (byte)0, (byte)0, (byte)1, (byte)0, (byte)0,
65
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
66
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
67
			(byte)1, (byte)0, (byte)1, (byte)0, (byte)0, (byte)0,
68
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
69
			(byte)0, (byte)0, (byte)1, (byte)1, (byte)0, (byte)0,
70
			(byte)0, (byte)1, (byte)1, (byte)0, (byte)0, (byte)0,
71
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
72
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0, (byte)0,
73
			(byte)0, (byte)0, (byte)0, (byte)0, (byte)0 };
74
75
	/**
76
	 * The customized cursor
77
	 */
78
	private Cursor cursor;
79
80
	/**
81
	 * The RGB value of the cursor
82
	 */
83
	private RGB rgb;
84
85
	/**
86
	 * Constructs an instance of MonoColorIBeamCursor with given color.
87
	 * 
88
	 * @param rgb cursor color, rgb can not be null
89
	 */
90
	public MonoColorIBeamCursor(RGB rgb) {
91
		Assert.isTrue(rgb != null);
92
		this.rgb= rgb;
93
		createCursor();
94
	}
95
96
	/**
97
	 * Dispose the cursor if necessary
98
	 */
99
	public void dispose() {
100
		if (cursor != null) {
101
			cursor.dispose();
102
			cursor= null;
103
		}
104
	}
105
106
	/**
107
	 * Return the colored I-Beam cursor or null.
108
	 * 
109
	 * @return the cursor
110
	 */
111
	public Cursor getCursor() {
112
		return cursor;
113
	}
114
115
	/**
116
	 * Set the color of the I-Beam cursor
117
	 * 
118
	 * @param rgb a new color, rgb can not be null
119
	 */
120
	public void setRGB(RGB rgb) {
121
		Assert.isTrue(rgb != null);
122
		if (!this.rgb.equals(rgb)) {
123
			this.rgb= rgb;
124
			dispose();
125
			createCursor();
126
		}
127
	}
128
129
	/**
130
	 * Create a I-Beam cursor with given color
131
	 */
132
	private void createCursor() {
133
		Display display= PlatformUI.getWorkbench().getDisplay();
134
		if (display != null && !display.isDisposed()) {
135
			RGB[] colors= { new RGB(0, 0, 0), new RGB(rgb.red, rgb.green, rgb.blue) };
136
			PaletteData palette= new PaletteData(colors);
137
			ImageData cursorData= new ImageData(16, 16, 8, palette, 4, ibeamShape);
138
			cursorData.transparentPixel= 0;
139
			cursor= new Cursor(display, cursorData, 8, 8);
140
		}
141
	}
142
}
(-)src/org/eclipse/ui/internal/texteditor/TextEditorPlugin.java (+27 lines)
Lines 16-21 Link Here
16
16
17
import org.osgi.framework.BundleContext;
17
import org.osgi.framework.BundleContext;
18
18
19
import org.eclipse.swt.graphics.Cursor;
20
import org.eclipse.swt.graphics.RGB;
19
import org.eclipse.core.runtime.Assert;
21
import org.eclipse.core.runtime.Assert;
20
import org.eclipse.core.runtime.IRegistryChangeEvent;
22
import org.eclipse.core.runtime.IRegistryChangeEvent;
21
import org.eclipse.core.runtime.IRegistryChangeListener;
23
import org.eclipse.core.runtime.IRegistryChangeListener;
Lines 63-68 Link Here
63
	private SpellingEngineRegistry fSpellingEngineRegistry;
65
	private SpellingEngineRegistry fSpellingEngineRegistry;
64
66
65
	/**
67
	/**
68
	 * The shared I-Beam cursor for text based editors
69
	 */
70
	private MonoColorIBeamCursor sharedIBeamCursor;
71
	
72
	/**
66
	 * Creates a plug-in instance.
73
	 * Creates a plug-in instance.
67
	 */
74
	 */
68
	public TextEditorPlugin() {
75
	public TextEditorPlugin() {
Lines 164-169 Link Here
164
		Platform.getExtensionRegistry().removeRegistryChangeListener(this);
171
		Platform.getExtensionRegistry().removeRegistryChangeListener(this);
165
		fQuickDiffExtensionRegistry= null;
172
		fQuickDiffExtensionRegistry= null;
166
		fSpellingEngineRegistry= null;
173
		fSpellingEngineRegistry= null;
174
		if (sharedIBeamCursor != null) {
175
			sharedIBeamCursor.dispose();
176
			sharedIBeamCursor= null;
177
		}
167
		super.stop(context);
178
		super.stop(context);
168
	}
179
	}
169
180
Lines 197-200 Link Here
197
	public SpellingEngineRegistry getSpellingEngineRegistry() {
208
	public SpellingEngineRegistry getSpellingEngineRegistry() {
198
		return fSpellingEngineRegistry;
209
		return fSpellingEngineRegistry;
199
	}
210
	}
211
	
212
	/**
213
	 * Return the I-Beam cursor with the given color.
214
	 * 
215
	 * @param rgb the cursor color
216
	 * @return an I-Beam cursor
217
	 */
218
	public Cursor getSharedIBeamCursor(RGB rgb) {
219
		if (rgb == null)
220
			return null;
221
		if (sharedIBeamCursor == null)
222
			sharedIBeamCursor= new MonoColorIBeamCursor(rgb);
223
		else
224
			sharedIBeamCursor.setRGB(rgb);
225
		return sharedIBeamCursor.getCursor();
226
	}
200
}
227
}
(-)src/org/eclipse/ui/texteditor/SourceViewerDecorationSupport.java (+44 lines)
Lines 17-22 Link Here
17
import org.eclipse.swt.SWT;
17
import org.eclipse.swt.SWT;
18
import org.eclipse.swt.custom.StyledText;
18
import org.eclipse.swt.custom.StyledText;
19
import org.eclipse.swt.graphics.Color;
19
import org.eclipse.swt.graphics.Color;
20
import org.eclipse.swt.graphics.Cursor;
20
import org.eclipse.swt.graphics.GC;
21
import org.eclipse.swt.graphics.GC;
21
import org.eclipse.swt.graphics.Point;
22
import org.eclipse.swt.graphics.Point;
22
import org.eclipse.swt.graphics.RGB;
23
import org.eclipse.swt.graphics.RGB;
Lines 43-48 Link Here
43
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
44
import org.eclipse.jface.text.source.AnnotationPainter.IDrawingStrategy;
44
import org.eclipse.jface.text.source.AnnotationPainter.ITextStyleStrategy;
45
import org.eclipse.jface.text.source.AnnotationPainter.ITextStyleStrategy;
45
46
47
import org.eclipse.ui.internal.texteditor.TextEditorPlugin;
48
46
49
47
50
48
51
Lines 227-232 Link Here
227
	private Map fAnnotationTypeKeyMap= new LinkedHashMap();
230
	private Map fAnnotationTypeKeyMap= new LinkedHashMap();
228
	/** Preference key for the cursor line highlighting */
231
	/** Preference key for the cursor line highlighting */
229
	private String fCursorLinePainterEnableKey;
232
	private String fCursorLinePainterEnableKey;
233
	/** preference key for the enabling cursor color */
234
	private String fCursorColorDefaultKey;
235
	/** preference key for the cursor color */
236
	private String fCursorColorKey;
230
	/** Preference key for the cursor line background color */
237
	/** Preference key for the cursor line background color */
231
	private String fCursorLinePainterColorKey;
238
	private String fCursorLinePainterColorKey;
232
	/** Preference key for the margin painter */
239
	/** Preference key for the margin painter */
Lines 310-315 Link Here
310
		else
317
		else
311
			hideMargin();
318
			hideMargin();
312
319
320
		updateCursorColor();
321
		
313
		Iterator e= fAnnotationTypeKeyMap.keySet().iterator();
322
		Iterator e= fAnnotationTypeKeyMap.keySet().iterator();
314
		while (e.hasNext()) {
323
		while (e.hasNext()) {
315
			Object type= e.next();
324
			Object type= e.next();
Lines 445-450 Link Here
445
		fCursorLinePainterEnableKey= enableKey;
454
		fCursorLinePainterEnableKey= enableKey;
446
		fCursorLinePainterColorKey= colorKey;
455
		fCursorLinePainterColorKey= colorKey;
447
	}
456
	}
457
	
458
	/**
459
	 * Sets the preference keys for the cursor color.
460
	 * 
461
	 * @param defaultKey the preference key for the enabling cursor color
462
	 * @param colorKey the preference key for the cursor color
463
	 */
464
	public void setCursorColorPreferenceKeys(String defaultKey, String colorKey) {
465
		fCursorColorDefaultKey= defaultKey;
466
		fCursorColorKey= colorKey;
467
	}
448
468
449
	/**
469
	/**
450
	 * Sets the preference keys for the margin painter.
470
	 * Sets the preference keys for the margin painter.
Lines 534-539 Link Here
534
			}
554
			}
535
			return;
555
			return;
536
		}
556
		}
557
		
558
		if (fCursorColorDefaultKey != null && fCursorColorKey != null) {
559
			if (fCursorColorDefaultKey.equals(p) || fCursorColorKey.equals(p))
560
				updateCursorColor();
561
		}
537
562
538
		if (fMarginPainterEnableKey != null && fMarginPainterEnableKey.equals(p)) {
563
		if (fMarginPainterEnableKey != null && fMarginPainterEnableKey.equals(p)) {
539
			if (isMarginShown())
564
			if (isMarginShown())
Lines 967-970 Link Here
967
			fOverviewRuler.update();
992
			fOverviewRuler.update();
968
		}
993
		}
969
	}
994
	}
995
	
996
	/**
997
	 * Update the cursor color for the editor
998
	 */
999
	private void updateCursorColor() {
1000
		if (fPreferenceStore == null || fSourceViewer != null)
1001
			return;
1002
		StyledText textWidget= fSourceViewer.getTextWidget();
1003
		if (textWidget == null || textWidget.isDisposed())
1004
			return;
1005
1006
		if (fPreferenceStore.getBoolean(fCursorColorDefaultKey)) {
1007
			textWidget.setCursor(null);
1008
		} else {
1009
			RGB rgb= PreferenceConverter.getColor(fPreferenceStore, fCursorColorKey);
1010
			Cursor cursor= TextEditorPlugin.getDefault().getSharedIBeamCursor(rgb);
1011
			textWidget.setCursor(cursor);
1012
		}
1013
	}
970
}
1014
}

Return to bug 309660