From a50bb821beaaf193dc9bf412316a0c15b32ac0f1 Mon Sep 17 00:00:00 2001 From: Andrey Loskutov Date: Tue, 5 Aug 2014 19:09:27 +0200 Subject: Bug 35779 - [misc] Text Viewer and Editor needs to support word wrap Added "Enable word wrap when opening an editor" preference to "Text Editors" preference page, "Toggle Word Wrap" text editor action / toolbar button and ALT+SHIFT+Y shortcut for text editors extending AbstractTextEditor. Change-Id: Ibc4d64d0c76a31aff781726336d41b9ee1cbd659 Also-by: Florian Weßling Also-by: Holger Voormann Also-by: Lars Vogel Signed-off-by: Andrey Loskutov --- org.eclipse.ui.editors/META-INF/MANIFEST.MF | 2 +- org.eclipse.ui.editors/plugin.properties | 4 +++- org.eclipse.ui.editors/plugin.xml | 9 +++++++-- .../internal/editors/text/TextEditorDefaultsPreferencePage.java | 7 ++++++- .../org/eclipse/ui/internal/editors/text/TextEditorMessages.java | 3 ++- .../ui/internal/editors/text/TextEditorMessages.properties | 1 + .../AbstractDecoratedTextEditorPreferenceConstants.java | 3 ++- 7 files changed, 22 insertions(+), 7 deletions(-) (limited to 'org.eclipse.ui.editors') diff --git a/org.eclipse.ui.editors/META-INF/MANIFEST.MF b/org.eclipse.ui.editors/META-INF/MANIFEST.MF index 6dc39a9ed77..5e5a2e98bdc 100644 --- a/org.eclipse.ui.editors/META-INF/MANIFEST.MF +++ b/org.eclipse.ui.editors/META-INF/MANIFEST.MF @@ -21,7 +21,7 @@ Require-Bundle: org.eclipse.ui.ide;bundle-version="[3.5.0,4.0.0)", org.eclipse.ui;bundle-version="[3.5.0,4.0.0)", org.eclipse.jface.text;bundle-version="[3.8.0,4.0.0)", - org.eclipse.ui.workbench.texteditor;bundle-version="[3.7.0,4.0.0)", + org.eclipse.ui.workbench.texteditor;bundle-version="[3.10.0,4.0.0)", org.eclipse.core.filebuffers;visibility:=reexport;bundle-version="[3.5.0,4.0.0)", org.eclipse.core.resources;bundle-version="[3.5.0,4.0.0)", org.eclipse.core.filesystem;bundle-version="[1.2.0,2.0.0)" diff --git a/org.eclipse.ui.editors/plugin.properties b/org.eclipse.ui.editors/plugin.properties index ddb21a870db..ed4969788f6 100644 --- a/org.eclipse.ui.editors/plugin.properties +++ b/org.eclipse.ui.editors/plugin.properties @@ -1,5 +1,5 @@ ############################################################################### -# Copyright (c) 2000, 2014 IBM Corporation and others. +# Copyright (c) 2000, 2015 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 @@ -8,6 +8,7 @@ # Contributors: # IBM Corporation - initial API and implementation # Alex Weirig - Collapse All (https://bugs.eclipse.org/bugs/show_bug.cgi?id=65268) +# Florian Weßling - Adding (soft) word wrap (https://bugs.eclipse.org/bugs/show_bug.cgi?id=35779) ############################################################################### pluginName= Default Text Editor providerName= Eclipse.org @@ -123,6 +124,7 @@ preferenceKeywords.accessibility= accessibility caret cursor quick diff text edi preferenceKeywords.spelling= spelling spell checking dictionary correction check text editor preferenceKeywords.linkedmode= editor linked mode template preferenceKeywords.hyperlinkDetectors= hyperlinking text editor on demand link navigation modifier key +preferenceKeywords.wordWrap= word wrap wordwrap wrapping wordwrapping soft text line break linebreak #--- linked mode annotations linked.focus.label= Current range diff --git a/org.eclipse.ui.editors/plugin.xml b/org.eclipse.ui.editors/plugin.xml index 9d824937ff5..bea4d3b31fe 100644 --- a/org.eclipse.ui.editors/plugin.xml +++ b/org.eclipse.ui.editors/plugin.xml @@ -1,6 +1,6 @@ - + @@ -9,7 +9,8 @@ - + + @@ -224,6 +225,7 @@ + + 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 42e57c619af..85e569c9b79 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, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -681,6 +681,7 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_CURRENT_LINE)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.INT, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_TAB_WIDTH)); + overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractTextEditor.PREFERENCE_WORD_WRAP_ENABLED)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.BOOLEAN, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS)); overlayKeys.add(new OverlayPreferenceStore.OverlayKey(OverlayPreferenceStore.STRING, AbstractDecoratedTextEditorPreferenceConstants.EDITOR_PRINT_MARGIN_COLOR)); @@ -805,6 +806,10 @@ public class TextEditorDefaultsPreferencePage extends PreferencePage implements IntegerDomain tabWidthDomain= new IntegerDomain(1, 16); addTextField(appearanceComposite, tabWidth, tabWidthDomain, 15, 0); + label= TextEditorMessages.TextEditorPreferencePage_enableWordWrap; + Preference enableWordWrap= new Preference(AbstractTextEditor.PREFERENCE_WORD_WRAP_ENABLED, label, null); + addCheckBox(appearanceComposite, enableWordWrap, new BooleanDomain(), 0); + label= TextEditorMessages.TextEditorPreferencePage_convertTabsToSpaces; Preference spacesForTabs= new Preference(AbstractDecoratedTextEditorPreferenceConstants.EDITOR_SPACES_FOR_TABS, label, null); addCheckBox(appearanceComposite, spacesForTabs, new BooleanDomain(), 0); 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 dcbf8c8cd7e..6d6044d45ef 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, 2012 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -31,6 +31,7 @@ final class TextEditorMessages extends NLS { public static String EditorsPlugin_internal_error; public static String LinkedModeConfigurationBlock_DASHED_BOX; public static String TextEditorPreferencePage_displayedTabWidth; + public static String TextEditorPreferencePage_enableWordWrap; public static String TextEditorPreferencePage_convertTabsToSpaces; public static String TextEditorPreferencePage_undoHistorySize; public static String TextEditorPreferencePage_printMarginColumn; 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 0b2129623f2..053cf9fd2ef 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 @@ -13,6 +13,7 @@ EditorsPlugin_additionalInfo_affordance=Press 'Tab' from proposal table or click EditorsPlugin_internal_error=Internal Error TextEditorPreferencePage_displayedTabWidth=Displayed &tab width: +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: 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 22a9a61e167..7bd29665ec3 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, 2011 IBM Corporation and others. + * Copyright (c) 2000, 2015 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 @@ -745,6 +745,7 @@ public class AbstractDecoratedTextEditorPreferenceConstants { store.setDefault(EDITOR_TEXT_DRAG_AND_DROP_ENABLED, true); store.setDefault(EDITOR_SHOW_TEXT_HOVER_AFFORDANCE, true); store.setDefault(EDITOR_HOVER_ENRICH_MODE, 0); + store.setDefault(AbstractTextEditor.PREFERENCE_WORD_WRAP_ENABLED, false); MarkerAnnotationPreferences.initializeDefaultValues(store); -- cgit v1.2.3