diff options
author | Dani Megert | 2018-05-03 14:07:48 +0000 |
---|---|---|
committer | Dani Megert | 2018-05-03 14:07:48 +0000 |
commit | 4ed3b6f29149d8c45e8c51b45c35088f3032cdf9 (patch) | |
tree | ab6c65c43689ce1789ac78fcd0934a4e986e8d53 /org.eclipse.ui.editors | |
parent | f9ef44ee8069742d002309b19fbd44ea60e8620d (diff) | |
download | eclipse.platform.text-4ed3b6f29149d8c45e8c51b45c35088f3032cdf9.tar.gz eclipse.platform.text-4ed3b6f29149d8c45e8c51b45c35088f3032cdf9.tar.xz eclipse.platform.text-4ed3b6f29149d8c45e8c51b45c35088f3032cdf9.zip |
Fixed bug 468307: [Preferences] Print margin's behavior is confusing to many users
Diffstat (limited to 'org.eclipse.ui.editors')
6 files changed, 48 insertions, 5 deletions
diff --git a/org.eclipse.ui.editors/.settings/.api_filters b/org.eclipse.ui.editors/.settings/.api_filters index c062b4ac10e..c45a2f25c37 100644 --- a/org.eclipse.ui.editors/.settings/.api_filters +++ b/org.eclipse.ui.editors/.settings/.api_filters @@ -1,5 +1,13 @@ <?xml version="1.0" encoding="UTF-8" standalone="no"?> <component id="org.eclipse.ui.editors" version="2"> + <resource path="META-INF/MANIFEST.MF"> + <filter comment="The new field has @noreference, hence not a new API" id="924844039"> + <message_arguments> + <message_argument value="3.11.100"/> + <message_argument value="3.11.0"/> + </message_arguments> + </filter> + </resource> <resource path="src/org/eclipse/ui/editors/text/ITextEditorHelpContextIds.java" type="org.eclipse.ui.editors.text.ITextEditorHelpContextIds"> <filter id="571473929"> <message_arguments> @@ -8,6 +16,13 @@ </message_arguments> </filter> </resource> + <resource path="src/org/eclipse/ui/texteditor/AbstractDecoratedTextEditorPreferenceConstants.java" type="org.eclipse.ui.texteditor.AbstractDecoratedTextEditorPreferenceConstants"> + <filter comment="@since tag not needed since @noreference and hence no API" id="1143996420"> + <message_arguments> + <message_argument value="EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE"/> + </message_arguments> + </filter> + </resource> <resource path="src/org/eclipse/ui/texteditor/DefaultMarkerAnnotationAccess.java" type="org.eclipse.ui.texteditor.DefaultMarkerAnnotationAccess"> <filter id="643842064"> <message_arguments> diff --git a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java index 3f878686f45..987373fcc0c 100644 --- a/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java +++ b/org.eclipse.ui.editors/src/org/eclipse/ui/internal/editors/text/TextEditorDefaultsPreferencePage.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2016 IBM Corporation and others. + * Copyright (c) 2000, 2018 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 @@ -703,6 +703,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_UNDO_HISTORY_SIZE)); @@ -844,6 +845,11 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements final IntegerDomain printMarginDomain= new IntegerDomain(20, 200); final Control[] printMarginControls= addTextField(appearanceComposite, printMarginColumn, printMarginDomain, 15, 20); createDependency(showPrintMarginButton, showPrintMargin, printMarginControls); + + label= TextEditorMessages.TextEditorPreferencePage_printMarginAllowOverride; + Preference printMarginAllowOverride= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE, label, null); + final Button showPrintMarginAllowOverride= addCheckBox(appearanceComposite, printMarginAllowOverride, new BooleanDomain(), 0); + createDependency(showPrintMarginButton, showPrintMargin, new Control[] { showPrintMarginAllowOverride }); showPrintMarginButton.addSelectionListener(new SelectionAdapter() { @Override 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 6d6044d45ef..ac3904adf9f 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, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 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 @@ -35,6 +35,7 @@ final class TextEditorMessages extends NLS { public static String TextEditorPreferencePage_convertTabsToSpaces; public static String TextEditorPreferencePage_undoHistorySize; public static String TextEditorPreferencePage_printMarginColumn; + public static String TextEditorPreferencePage_printMarginAllowOverride; public static String TextEditorPreferencePage_showLineNumbers; public static String TextEditorPreferencePage_highlightCurrentLine; public static String TextEditorPreferencePage_showPrintMargin; 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 053cf9fd2ef..40965d6da38 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, 2015 IBM Corporation and others. +# Copyright (c) 2000, 2018 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 @@ -17,6 +17,7 @@ TextEditorPreferencePage_enableWordWrap=&Enable word wrap when opening an editor TextEditorPreferencePage_convertTabsToSpaces=&Insert spaces for tabs TextEditorPreferencePage_undoHistorySize=&Undo history size: TextEditorPreferencePage_printMarginColumn=Print margin colu&mn: +TextEditorPreferencePage_printMarginAllowOverride=Allow &editors to override the margin column TextEditorPreferencePage_showLineNumbers=Show line num&bers TextEditorPreferencePage_highlightCurrentLine=Hi&ghlight current line TextEditorPreferencePage_showPrintMargin=Sho&w print margin 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 84ee242fe95..a8e36955a97 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 @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2017 IBM Corporation and others. + * Copyright (c) 2000, 2018 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 @@ -202,6 +202,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { */ private final static String PRINT_MARGIN_COLUMN= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN; /** + * Preference key for telling whether editors are allowed to override the global print margin preferences. + */ + private final static String PRINT_MARGIN_ALLOW_OVERRIDE= AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE; + /** * Preference key to get whether the overwrite mode is disabled. * @since 3.1 */ @@ -951,6 +955,10 @@ public abstract class AbstractDecoratedTextEditor extends StatusTextEditor { if (fSourceViewerDecorationSupport == null) { fSourceViewerDecorationSupport= new SourceViewerDecorationSupport(viewer, getOverviewRuler(), getAnnotationAccess(), getSharedColors()); configureSourceViewerDecorationSupport(fSourceViewerDecorationSupport); + + // Fix for overridden print margin column, see https://bugs.eclipse.org/468307 + if (!getPreferenceStore().getBoolean(PRINT_MARGIN_ALLOW_OVERRIDE)) + fSourceViewerDecorationSupport.setMarginPainterPreferenceKeys(PRINT_MARGIN, PRINT_MARGIN_COLOR, PRINT_MARGIN_COLUMN); } return fSourceViewerDecorationSupport; } 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 05b33341498..fca3dab37d1 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, 2015 IBM Corporation and others. + * Copyright (c) 2000, 2018 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 @@ -128,6 +128,17 @@ public class AbstractDecoratedTextEditorPreferenceConstants { public final static String EDITOR_PRINT_MARGIN_COLUMN= "printMarginColumn"; //$NON-NLS-1$ /** + * Tells whether editors are allowed to override the print margin preference (value + * <code>"printMarginAllowOverride"</code>). + * <p> + * The preference value is of type <code>boolean</code>. + * </p> + * + * @noreference This field is not intended to be referenced by clients. + */ + public final static String EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE= "printMarginAllowOverride"; //$NON-NLS-1$ + + /** * A named preference that controls whether the editor shows unknown * indicators in text (squiggly lines). * (value <code>"othersIndication"</code>). @@ -675,6 +686,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants { store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN, false); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLUMN, 80); + store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_ALLOW_OVERRIDE, false); store.setDefault(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_LINE_NUMBER_RULER, false); |