Skip to main content
aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorChristian Gabrisch2020-10-20 16:54:43 +0000
committerChristian Gabrisch2020-10-21 12:31:10 +0000
commit49a5770c15f2cef2d0f10cfc9359312e9f38186b (patch)
treeb36506b6b64f36fed00f7c2dfcfa7ac2033d198b
parent5c202200d26fa8f0fb07c46d3f92f5e4338b2f32 (diff)
downloadeclipse.platform.debug-49a5770c15f2cef2d0f10cfc9359312e9f38186b.tar.gz
eclipse.platform.debug-49a5770c15f2cef2d0f10cfc9359312e9f38186b.tar.xz
eclipse.platform.debug-49a5770c15f2cef2d0f10cfc9359312e9f38186b.zip
Bug 491853 - Persist Console View "Word Wrap" settingsY20201021-1200I20201021-1800
The "Word Wrap" setting will be persisted in preference store of org.eclipse.ui.console plugin. Additionally, this setting is added to the Debug Console Settings preference page. Change-Id: I13659bf4441b75e0bdf9bdda8456201ec9afa01a Signed-off-by: Christian Gabrisch <eclipse@cgabrisch.de>
-rw-r--r--org.eclipse.debug.ui/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java16
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java3
-rw-r--r--org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties3
-rw-r--r--org.eclipse.ui.console/META-INF/MANIFEST.MF2
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java9
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java3
-rw-r--r--org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java36
8 files changed, 63 insertions, 11 deletions
diff --git a/org.eclipse.debug.ui/META-INF/MANIFEST.MF b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
index e3894413b..8b9329f50 100644
--- a/org.eclipse.debug.ui/META-INF/MANIFEST.MF
+++ b/org.eclipse.debug.ui/META-INF/MANIFEST.MF
@@ -80,7 +80,7 @@ Export-Package: org.eclipse.debug.internal.ui;
Require-Bundle: org.eclipse.core.expressions;bundle-version="[3.4.0,4.0.0)",
org.eclipse.core.variables;bundle-version="[3.2.800,4.0.0)",
org.eclipse.ui;bundle-version="[3.115.0,4.0.0)",
- org.eclipse.ui.console;bundle-version="[3.5.300,4.0.0)",
+ org.eclipse.ui.console;bundle-version="[3.10.0,4.0.0)",
org.eclipse.help;bundle-version="[3.4.0,4.0.0)",
org.eclipse.debug.core;bundle-version="[3.9.0,4.0.0)";visibility:=reexport,
org.eclipse.jface;bundle-version="[3.21.0,4.0.0)",
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
index aec2308b0..9ee4e6119 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/ConsolePreferencePage.java
@@ -82,6 +82,8 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
private ConsoleIntegerFieldEditor fTabSizeEditor;
private BooleanFieldEditor autoScrollLockEditor;
+ private BooleanFieldEditor2 fWordWrapEditor;
+
private BooleanFieldEditor2 fInterpretControlCharactersEditor;
private BooleanFieldEditor2 fInterpretCrAsControlCharacterEditor;
@@ -149,6 +151,11 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
autoScrollLockEditor = new BooleanFieldEditor(IConsoleConstants.P_CONSOLE_AUTO_SCROLL_LOCK, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_enable_auto_scroll_lock, SWT.NONE, getFieldEditorParent());
addField(autoScrollLockEditor);
+
+ fWordWrapEditor = new BooleanFieldEditor2(IConsoleConstants.P_CONSOLE_WORD_WRAP,
+ DebugPreferencesMessages.ConsolePreferencePage_Enable_Word_Wrap_text, SWT.NONE, getFieldEditorParent());
+ addField(fWordWrapEditor);
+
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_OUT, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_output_3, SWT.NONE, getFieldEditorParent()));
addField(new BooleanFieldEditor(IDebugPreferenceConstants.CONSOLE_OPEN_ON_ERR, DebugPreferencesMessages.ConsolePreferencePage_Show__Console_View_when_there_is_program_error_3, SWT.NONE, getFieldEditorParent()));
@@ -203,6 +210,7 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
updateAutoScrollLockEditor();
updateBufferSizeEditor();
updateInterpretCrAsControlCharacterEditor();
+ updateWordWrapEditorFromConsolePreferences();
}
/**
@@ -242,6 +250,14 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements
}
/**
+ * Update enablement of word wrapping from Console plugin preference store.
+ */
+ protected void updateWordWrapEditorFromConsolePreferences() {
+ fWordWrapEditor.setPreferenceStore(ConsolePlugin.getDefault().getPreferenceStore());
+ fWordWrapEditor.load();
+ }
+
+ /**
* @see org.eclipse.jface.preference.PreferencePage#performDefaults()
*/
@Override
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
index 14fa191ee..7310f1cb6 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2019 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -37,6 +37,7 @@ public class DebugPreferencesMessages extends NLS {
public static String ConsolePreferencePage_13;
public static String ConsolePreferencePage_Interpret_control_characters;
public static String ConsolePreferencePage_Interpret_cr_as_control_character;
+ public static String ConsolePreferencePage_Enable_Word_Wrap_text;
public static String DebugPreferencePage_1;
public static String DebugPreferencePage_2;
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
index 2a454274d..45717805a 100644
--- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
+++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/DebugPreferencesMessages.properties
@@ -1,5 +1,5 @@
###############################################################################
-# Copyright (c) 2000, 2019 IBM Corporation and others.
+# Copyright (c) 2000, 2020 IBM Corporation and others.
#
# This program and the accompanying materials
# are made available under the terms of the Eclipse Public License 2.0
@@ -30,6 +30,7 @@ ConsolePreferencePage_13=Tab width must be between 1 and 100 inclusive.
ConsolePreferencePage_11=Back&ground color:
ConsolePreferencePage_Interpret_control_characters=Interpret ASCII &control characters
ConsolePreferencePage_Interpret_cr_as_control_character=Interpret Carriage &Return (\\r) as control character
+ConsolePreferencePage_Enable_Word_Wrap_text=E&nable word wrap
DebugPreferencePage_1=General Settings for Running and Debugging.
DebugPreferencePage_2=Re&use editor when displaying source code
diff --git a/org.eclipse.ui.console/META-INF/MANIFEST.MF b/org.eclipse.ui.console/META-INF/MANIFEST.MF
index 9c3bc07da..2de8914cd 100644
--- a/org.eclipse.ui.console/META-INF/MANIFEST.MF
+++ b/org.eclipse.ui.console/META-INF/MANIFEST.MF
@@ -2,7 +2,7 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: %pluginName
Bundle-SymbolicName: org.eclipse.ui.console; singleton:=true
-Bundle-Version: 3.9.300.qualifier
+Bundle-Version: 3.10.0.qualifier
Bundle-Activator: org.eclipse.ui.console.ConsolePlugin
Bundle-Vendor: %providerName
Bundle-Localization: plugin
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
index cbb02a8f5..1cfb1dc5d 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/console/IConsoleConstants.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2000, 2013 IBM Corporation and others.
+ * Copyright (c) 2000, 2020 IBM Corporation and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -157,6 +157,13 @@ public interface IConsoleConstants {
String P_BACKGROUND_COLOR = ConsolePlugin.getUniqueIdentifier() + ".P_BACKGROUND_COLOR"; //$NON-NLS-1$
/**
+ * Property constant indicating the user preference for word wrap enabling.
+ *
+ * @since 3.10
+ */
+ String P_CONSOLE_WORD_WRAP = ConsolePlugin.getUniqueIdentifier() + ".P_CONSOLE_WORD_WRAP"; //$NON-NLS-1$
+
+ /**
* The default tab size for text consoles.
*
* @since 3.1
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
index 71f199998..e87dc6605 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/ConsoleUIPreferenceInitializer.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2018 Andrey Loskutov <loskutov@gmx.de> and others.
+ * Copyright (c) 2018, 2020 Andrey Loskutov <loskutov@gmx.de> and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -28,6 +28,7 @@ public class ConsoleUIPreferenceInitializer extends AbstractPreferenceInitialize
public void initializeDefaultPreferences() {
IPreferenceStore prefs = ConsolePlugin.getDefault().getPreferenceStore();
prefs.setDefault(IConsoleConstants.P_CONSOLE_AUTO_SCROLL_LOCK, true);
+ prefs.setDefault(IConsoleConstants.P_CONSOLE_WORD_WRAP, false);
}
}
diff --git a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
index 75d7e93e7..05b197480 100644
--- a/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
+++ b/org.eclipse.ui.console/src/org/eclipse/ui/internal/console/WordWrapAction.java
@@ -1,5 +1,5 @@
/*******************************************************************************
- * Copyright (c) 2014 vogella GmbH
+ * Copyright (c) 2014, 2020 vogella GmbH and others.
*
* This program and the accompanying materials
* are made available under the terms of the Eclipse Public License 2.0
@@ -12,19 +12,25 @@
* Gaetano Santoro - initial implementation
* Matthias Mailänder - rebase onto Mars
* Lars Vogel <Lars.Vogel@gmail.com> - Bug 287303
+ * Christian Gabrisch <eclipse@cgabrisch.de> - Bug 491853
*******************************************************************************/
package org.eclipse.ui.internal.console;
import org.eclipse.jface.action.Action;
+import org.eclipse.jface.preference.IPreferenceStore;
+import org.eclipse.jface.util.IPropertyChangeListener;
+import org.eclipse.jface.util.PropertyChangeEvent;
import org.eclipse.ui.PlatformUI;
+import org.eclipse.ui.console.ConsolePlugin;
+import org.eclipse.ui.console.IConsoleConstants;
import org.eclipse.ui.console.IConsoleView;
/**
* Activates line breaks in the Console view so that the full log statement is
* always visible
*/
-public class WordWrapAction extends Action {
+public class WordWrapAction extends Action implements IPropertyChangeListener {
private IConsoleView fConsoleView = null;
@@ -38,16 +44,36 @@ public class WordWrapAction extends Action {
setImageDescriptor(ConsolePluginImages.getImageDescriptor(IInternalConsoleConstants.IMG_ELCL_WRAP));
PlatformUI.getWorkbench().getHelpSystem().setHelp(this, IConsoleHelpContextIds.CONSOLE_WORD_WRAP_ACTION);
- boolean checked = fConsoleView.getWordWrap();
- setChecked(checked);
+ getPreferenceStore().addPropertyChangeListener(this);
+ applyPreferences();
}
@Override
public void run() {
- fConsoleView.setWordWrap(isChecked());
+ boolean enableWordWrap = isChecked();
+ getPreferenceStore().setValue(IConsoleConstants.P_CONSOLE_WORD_WRAP, enableWordWrap);
+ }
+
+ @Override
+ public void propertyChange(PropertyChangeEvent event) {
+ String property = event.getProperty();
+ if (IConsoleConstants.P_CONSOLE_WORD_WRAP.equals(property)) {
+ applyPreferences();
+ }
}
public void dispose() {
+ getPreferenceStore().removePropertyChangeListener(this);
fConsoleView = null;
}
+
+ private void applyPreferences() {
+ boolean enableWordWrap = getPreferenceStore().getBoolean(IConsoleConstants.P_CONSOLE_WORD_WRAP);
+ setChecked(enableWordWrap);
+ fConsoleView.setWordWrap(enableWordWrap);
+ }
+
+ private IPreferenceStore getPreferenceStore() {
+ return ConsolePlugin.getDefault().getPreferenceStore();
+ }
}

Back to the top