diff options
author | Raksha Vasisht | 2011-10-24 10:52:13 +0000 |
---|---|---|
committer | Dani Megert | 2011-10-24 10:52:13 +0000 |
commit | e7881ae9494ff0db8f6f0dd7dfbab8fb42ed24ab (patch) | |
tree | d9a4a541a47cf5b383e8c340404aa882b7a45865 /org.eclipse.ui.editors/src/org/eclipse | |
parent | 10e6ec4fdd22131c8ce8631eabe9a66e5b34219c (diff) | |
download | eclipse.platform.text-e7881ae9494ff0db8f6f0dd7dfbab8fb42ed24ab.tar.gz eclipse.platform.text-e7881ae9494ff0db8f6f0dd7dfbab8fb42ed24ab.tar.xz eclipse.platform.text-e7881ae9494ff0db8f6f0dd7dfbab8fb42ed24ab.zip |
Fixed bug 341808: [api][rulers][preferences] Add preference that allowsv20111024-1515
to disable Overview ruler color wash out
Diffstat (limited to 'org.eclipse.ui.editors/src/org/eclipse')
5 files changed, 53 insertions, 4 deletions
diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java index 1ccbf51f2e1..7596bb84f6d 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/AccessibilityPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2009 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -363,6 +363,7 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WIDE_CARET)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.USE_SATURATED_COLORS_IN_OVERVIEW_RULER)); OverlayPreferenceStore.OverlayKey[] keys= new OverlayPreferenceStore.OverlayKey[overlayKeys.size()]; overlayKeys.toArray(keys); @@ -407,6 +408,10 @@ public class AccessibilityPreferencePage extends PreferencePage implements IWork Preference quickDiffTextMode= new Preference(AbstractDecoratedTextEditorPreferenceConstants.QUICK_DIFF_CHARACTER_MODE, label, null); addCheckBox(appearanceComposite, quickDiffTextMode, new BooleanDomain(), 0); + label= TextEditorMessages.TextEditorPreferencePage_accessibility_useSaturatedColorsInOverviewRuler; + Preference useSaturatedColors= new Preference(AbstractDecoratedTextEditorPreferenceConstants.USE_SATURATED_COLORS_IN_OVERVIEW_RULER, label, null); + addCheckBox(appearanceComposite, useSaturatedColors, new BooleanDomain(), 0); + return appearanceComposite; } diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java index 6d80df98a89..2110f278a39 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -47,6 +47,7 @@ final class TextEditorMessages extends NLS { public static String TextEditorPreferencePage_findScopeColor; public static String TextEditorPreferencePage_accessibility_disableCustomCarets; public static String TextEditorPreferencePage_accessibility_wideCaret; + public static String TextEditorPreferencePage_accessibility_useSaturatedColorsInOverviewRuler; public static String TextEditorPreferencePage_showAffordance; public static String TextEditorPreferencePage_selectionForegroundColor; public static String TextEditorPreferencePage_selectionBackgroundColor; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties index ac2bf2c75bb..2d2eba92c28 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorMessages.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2010 IBM Corporation and others. +# Copyright (c) 2000, 2011 IBM Corporation and others. # All rights reserved. This program and the accompanying materials # are made available under the terms of the Eclipse Public License v1.0 # which accompanies this distribution, and is available at @@ -29,6 +29,7 @@ TextEditorPreferencePage_backgroundColor=Background color TextEditorPreferencePage_findScopeColor=Find scope TextEditorPreferencePage_accessibility_disableCustomCarets= Use &custom caret TextEditorPreferencePage_accessibility_wideCaret= &Enable thick caret +TextEditorPreferencePage_accessibility_useSaturatedColorsInOverviewRuler=U&se saturated colors in overview ruler TextEditorDefaultsPreferencePage_carriageReturn=Carriage Return ( \u00a4 ) TextEditorDefaultsPreferencePage_transparencyLevel=&Transparency level (0 is transparent and 255 is opaque): TextEditorDefaultsPreferencePage_configureWhitespaceCharacterPainterProperties=Configure visibility of whitespace characters in different regions of a line of text: diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java index 06fd1eb6918..5d264cbd6be 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditor.java @@ -101,6 +101,7 @@ import org.eclipse.jface.text.source.IAnnotationHover; import org.eclipse.jface.text.source.IAnnotationModel; import org.eclipse.jface.text.source.IChangeRulerColumn; import org.eclipse.jface.text.source.IOverviewRuler; +import org.eclipse.jface.text.source.IOverviewRulerExtension; import org.eclipse.jface.text.source.ISharedTextColors; import org.eclipse.jface.text.source.ISourceViewer; import org.eclipse.jface.text.source.ISourceViewerExtension; @@ -214,6 +215,13 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { */ public final static String DEFAULT_OVERVIEW_RULER_CONTEXT_MENU_ID= "#OverviewRulerContext"; //$NON-NLS-1$ + /** + * Preference key that controls whether to use saturated colors in the overview ruler. + * + * @since 3.8 + */ + private static final String USE_SATURATED_COLORS_IN_OVERVIEW_RULER= AbstractDecoratedTextEditorPreferenceConstants.USE_SATURATED_COLORS_IN_OVERVIEW_RULER; + /** * Adapter class for <code>IGotoMarker</code>. @@ -452,6 +460,9 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { if (isPrefQuickDiffAlwaysOn()) showChangeInformation(true); + if (fOverviewRuler instanceof IOverviewRulerExtension) + ((IOverviewRulerExtension)fOverviewRuler).setUseSaturatedColors(isPrefUseSaturatedColorsOn()); + if (!isOverwriteModeEnabled()) enableOverwriteMode(false); @@ -649,6 +660,18 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { } /** + * Checks if the preference to use saturated colors is enabled for the overview ruler. + * + * @return <code>true</code> if the saturated colors preference is enabled, <code>false</code> + * otherwise + * @since 3.8 + */ + private boolean isPrefUseSaturatedColorsOn() { + IPreferenceStore store= getPreferenceStore(); + return store != null ? store.getBoolean(USE_SATURATED_COLORS_IN_OVERVIEW_RULER) : false; + } + + /** * Initializes the given line number ruler column from the preference store. * * @param rulerColumn the ruler column to be initialized @@ -802,6 +825,13 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { return; } + if (USE_SATURATED_COLORS_IN_OVERVIEW_RULER.equals(property)) { + if (fOverviewRuler instanceof IOverviewRulerExtension) { + ((IOverviewRulerExtension)fOverviewRuler).setUseSaturatedColors(isPrefUseSaturatedColorsOn()); + fOverviewRuler.update(); + } + } + if (DISABLE_OVERWRITE_MODE.equals(property)) { enableOverwriteMode(isOverwriteModeEnabled()); return; diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java index ed63933bd15..22a9a61e167 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2010 IBM Corporation and others. + * Copyright (c) 2000, 2011 IBM Corporation and others. * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * which accompanies this distribution, and is available at @@ -254,6 +254,17 @@ public class AbstractDecoratedTextEditorPreferenceConstants { public static final String EDITOR_WIDE_CARET= AbstractTextEditor.PREFERENCE_WIDE_CARET; /** + * A named preference that controls whether to use saturated colors in the overview ruler. + * <p> + * Value is of type <code>Boolean</code>. If <code>true</code>, saturated colors are used + * </p> + * + * @since 3.8 + * @see org.eclipse.jface.text.source.IOverviewRulerExtension#setUseSaturatedColors(boolean) + */ + public static final String USE_SATURATED_COLORS_IN_OVERVIEW_RULER= "Accessibility.UseSaturatedColors"; //$NON-NLS-1$; + + /** * A named preference that holds the color used as the text selection foreground. * This value has no effect if the system default color is used. * <p> @@ -677,6 +688,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants { store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_USE_CUSTOM_CARETS, false); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_WIDE_CARET, true); + store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.USE_SATURATED_COLORS_IN_OVERVIEW_RULER, false); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_FOREGROUND_DEFAULT_COLOR, true); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SELECTION_BACKGROUND_DEFAULT_COLOR, true); |