diff options
Diffstat (limited to 'org.eclipse.debug.ui/ui/org')
6 files changed, 64 insertions, 4 deletions
diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java index 955bda6f4..3fb4c5069 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/DebugUIPreferenceInitializer.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2004, 2018 IBM Corporation and others. + * Copyright (c) 2004, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -80,6 +80,8 @@ public class DebugUIPreferenceInitializer extends AbstractPreferenceInitializer prefs.setDefault(IDebugPreferenceConstants.CONSOLE_LOW_WATER_MARK, 80000); prefs.setDefault(IDebugPreferenceConstants.CONSOLE_HIGH_WATER_MARK, 100000); prefs.setDefault(IDebugPreferenceConstants.CONSOLE_TAB_WIDTH, 8); + prefs.setDefault(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS, false); + prefs.setDefault(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER, true); // console colors setThemeBasedPreferences(prefs, false); 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 881290b8e..7789876a4 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 @@ -81,6 +81,9 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements private ConsoleIntegerFieldEditor fTabSizeEditor; private BooleanFieldEditor autoScrollLockEditor; + private BooleanFieldEditor2 fInterpretControlCharactersEditor; + private BooleanFieldEditor2 fInterpretCrAsControlCharacterEditor; + /** * Create the console page. */ @@ -157,6 +160,15 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements addField(syserr); addField(sysin); addField(background); + + fInterpretControlCharactersEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS, DebugPreferencesMessages.ConsolePreferencePage_Interpret_control_characters, SWT.NONE, getFieldEditorParent()); + fInterpretCrAsControlCharacterEditor = new BooleanFieldEditor2(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER, DebugPreferencesMessages.ConsolePreferencePage_Interpret_cr_as_control_character, SWT.NONE, getFieldEditorParent()); + + fInterpretControlCharactersEditor.getChangeControl(getFieldEditorParent()).addListener(SWT.Selection, + event -> updateInterpretCrAsControlCharacterEditor()); + + addField(fInterpretControlCharactersEditor); + addField(fInterpretCrAsControlCharacterEditor); } /** @@ -186,6 +198,7 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements updateWidthEditor(); updateAutoScrollLockEditor(); updateBufferSizeEditor(); + updateInterpretCrAsControlCharacterEditor(); } /** @@ -216,6 +229,15 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements } /** + * Update enablement of carriage return interpretation based on general control + * character interpretation. + */ + protected void updateInterpretCrAsControlCharacterEditor() { + Button b = fInterpretControlCharactersEditor.getChangeControl(getFieldEditorParent()); + fInterpretCrAsControlCharacterEditor.getChangeControl(getFieldEditorParent()).setEnabled(b.getSelection()); + } + + /** * @see org.eclipse.jface.preference.PreferencePage#performDefaults() */ @Override @@ -223,6 +245,7 @@ public class ConsolePreferencePage extends FieldEditorPreferencePage implements super.performDefaults(); updateWidthEditor(); updateBufferSizeEditor(); + updateInterpretCrAsControlCharacterEditor(); } protected boolean canClearErrorMessage() { 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 41b530612..b74176979 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, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -35,6 +35,8 @@ public class DebugPreferencesMessages extends NLS { public static String ConsolePreferencePage_console_width; public static String ConsolePreferencePage_12; public static String ConsolePreferencePage_13; + public static String ConsolePreferencePage_Interpret_control_characters; + public static String ConsolePreferencePage_Interpret_cr_as_control_character; 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 36ddf277d..c4cabbc6c 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, 2018 IBM Corporation and others. +# Copyright (c) 2000, 2019 IBM Corporation and others. # # This program and the accompanying materials # are made available under the terms of the Eclipse Public License 2.0 @@ -28,6 +28,8 @@ ConsolePreferencePage_console_width=Character width must be between 80 and 1000 ConsolePreferencePage_12=Displayed &tab width: 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 DebugPreferencePage_1=General Settings for Running and Debugging. DebugPreferencePage_2=Re&use editor when displaying source code diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java index 93d9c16ac..9b9355f8c 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/preferences/IDebugPreferenceConstants.java @@ -1,5 +1,5 @@ /******************************************************************************* - * Copyright (c) 2000, 2018 IBM Corporation and others. + * Copyright (c) 2000, 2019 IBM Corporation and others. * * This program and the accompanying materials * are made available under the terms of the Eclipse Public License 2.0 @@ -91,7 +91,31 @@ public interface IDebugPreferenceConstants { */ String CONSOLE_TAB_WIDTH= "Console.console_tab_width"; //$NON-NLS-1$ + /** + * (boolean) If <code>true</code> console will interpret ASCII control + * characters like <code>\b</code> received from stdout or stderr (or any other + * connected output stream). + * <p> + * If <code>false</code> control characters are appended to console like any + * other character. Since they are usually not printable they may be invisible + * or result in some Unicode default representation. + * </p> + */ + String CONSOLE_INTERPRET_CONTROL_CHARACTERS = "Console.interpret_control_characters"; //$NON-NLS-1$ + /** + * (boolean) Only used if {@link #CONSOLE_INTERPRET_CONTROL_CHARACTERS} is + * <code>true</code>. + * <p> + * If <code>true</code> carriage returns are handled with there usual control + * character interpretation. (move output cursor to begin of line) + * </p> + * <p> + * If <code>false</code> carriage returns are not handled special and may result + * in line breaks since they are usually legal line delimiter. + * </p> + */ + String CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER = "Console.interpret_cr_as_control_characters"; //$NON-NLS-1$ /** * The orientation of the detail view in the VariablesView diff --git a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java index bfb739aab..4f510b26e 100644 --- a/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java +++ b/org.eclipse.debug.ui/ui/org/eclipse/debug/internal/ui/views/console/ProcessConsole.java @@ -376,6 +376,10 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); } else if (property.equals(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)) { setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)); + } else if (property.equals(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS)) { + setHandleControlCharacters(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS)); + } else if (property.equals(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER)) { + setCarriageReturnAsControlCharacter(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER)); } } @@ -485,6 +489,9 @@ public class ProcessConsole extends IOConsole implements IConsole, IDebugEventSe setWaterMarks(lowWater, highWater); } + setHandleControlCharacters(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CONTROL_CHARACTERS)); + setCarriageReturnAsControlCharacter(store.getBoolean(IDebugPreferenceConstants.CONSOLE_INTERPRET_CR_AS_CONTROL_CHARACTER)); + DebugUIPlugin.getStandardDisplay().asyncExec(() -> { setFont(JFaceResources.getFont(IDebugUIConstants.PREF_CONSOLE_FONT)); setBackground(DebugUIPlugin.getPreferenceColor(IDebugPreferenceConstants.CONSOLE_BAKGROUND_COLOR)); |