Skip to main content
summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorJonah Graham2018-11-17 14:49:13 -0500
committerJonah Graham2018-11-17 14:55:31 -0500
commita7425a05b49cce226fae0e15ba149652283d09d8 (patch)
treecc0375c8af602d22889f68ddb5d3a8aff617e072 /core
parent39b6373f66688eadd773818da48947ce451ea8fd (diff)
downloadorg.eclipse.cdt-a7425a05b49cce226fae0e15ba149652283d09d8.tar.gz
org.eclipse.cdt-a7425a05b49cce226fae0e15ba149652283d09d8.tar.xz
org.eclipse.cdt-a7425a05b49cce226fae0e15ba149652283d09d8.zip
Bug 541270: Fix Restore Defaults for Console Prefs
Bug 414525 was trying to workaround Bug 270326/320723 but did not handle the case that no plugin_customization.ini was provided. This fix make Restore Defaults for Preferences -> C/C++ -> Build -> Console work again. Change-Id: Idbacc2a0baece6c3f594cfac4a2eeece886bac80
Diffstat (limited to 'core')
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java34
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java5
-rw-r--r--core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java2
3 files changed, 22 insertions, 19 deletions
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
index 538f032e6f..9ed1d2fc82 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/internal/ui/preferences/BuildConsolePreferencePage.java
@@ -247,38 +247,38 @@ public class BuildConsolePreferencePage extends FieldEditorPreferencePage implem
public void init(IWorkbench workbench) {
}
- public static void initDefaults(IPreferenceStore prefs) {
- if(!prefs.contains(PREF_CLEAR_CONSOLE))
+ public static void initDefaults(IPreferenceStore prefs, boolean unconditionally) {
+ if(unconditionally || !prefs.contains(PREF_CLEAR_CONSOLE))
prefs.setDefault(PREF_CLEAR_CONSOLE, true);
- if(!prefs.contains(PREF_AUTO_OPEN_CONSOLE))
+ if(unconditionally || !prefs.contains(PREF_AUTO_OPEN_CONSOLE))
prefs.setDefault(PREF_AUTO_OPEN_CONSOLE, true);
- if(!prefs.contains(PREF_CONSOLE_ON_TOP))
+ if(unconditionally || !prefs.contains(PREF_CONSOLE_ON_TOP))
prefs.setDefault(PREF_CONSOLE_ON_TOP, true);
- if(!prefs.contains(PREF_BUILDCONSOLE_WRAP_LINES))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_WRAP_LINES))
prefs.setDefault(PREF_BUILDCONSOLE_WRAP_LINES, false);
- if(!prefs.contains(PREF_BUILDCONSOLE_LINES))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_LINES))
prefs.setDefault(PREF_BUILDCONSOLE_LINES, 500);
- if(!prefs.contains(PREF_BUILDCONSOLE_WRAP_LINES_MAX))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_WRAP_LINES_MAX))
prefs.setDefault(PREF_BUILDCONSOLE_WRAP_LINES_MAX, 5000);
- if(!prefs.contains(PREF_BUILDCONSOLE_UPDATE_DELAY_MS))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_UPDATE_DELAY_MS))
prefs.setDefault(PREF_BUILDCONSOLE_UPDATE_DELAY_MS, DEFAULT_BUILDCONSOLE_UPDATE_DELAY_MS);
- if(!prefs.contains(PREF_BUILDCONSOLE_TAB_WIDTH))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_TAB_WIDTH))
prefs.setDefault(PREF_BUILDCONSOLE_TAB_WIDTH, 4);
- if(!prefs.contains(PREF_BUILDCONSOLE_OUTPUT_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_OUTPUT_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_OUTPUT_COLOR, new RGB(0, 0, 0));
- if(!prefs.contains(PREF_BUILDCONSOLE_INFO_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_INFO_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_INFO_COLOR, new RGB(0, 0, 255));
- if(!prefs.contains(PREF_BUILDCONSOLE_ERROR_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_ERROR_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_ERROR_COLOR, new RGB(255, 0, 0));
- if(!prefs.contains(PREF_BUILDCONSOLE_BACKGROUND_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_BACKGROUND_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_BACKGROUND_COLOR, new RGB(255, 255, 255));
- if(!prefs.contains(PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_PROBLEM_BACKGROUND_COLOR, new RGB(254, 231, 224));
- if(!prefs.contains(PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_PROBLEM_WARNING_BACKGROUND_COLOR, new RGB(254, 243, 218));
- if(!prefs.contains(PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_PROBLEM_INFO_BACKGROUND_COLOR, new RGB(244, 247, 254));
- if(!prefs.contains(PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR))
+ if(unconditionally || !prefs.contains(PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR))
PreferenceConverter.setDefault(prefs, PREF_BUILDCONSOLE_PROBLEM_HIGHLIGHTED_COLOR, new RGB(255, 0, 0));
}
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
index a02051c7bc..49a7ef5300 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPlugin.java
@@ -602,7 +602,10 @@ public class CUIPlugin extends AbstractUIPlugin {
@Override
public IStatus runInUIThread(IProgressMonitor monitor) {
// A workaround for black console bug 320723.
- BuildConsolePreferencePage.initDefaults(getPreferenceStore());
+ // As we are running initDefaults after preferences have already been
+ // initialized, we don't want to do it unconditionally as that
+ // would override the defaults set in plugin_customization.ini files
+ BuildConsolePreferencePage.initDefaults(getPreferenceStore(), false);
// Initialize ContentAssistMatcherPreference.
ContentAssistPreference.getInstance();
return Status.OK_STATUS;
diff --git a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
index fa8be83f6a..97d8fb3554 100644
--- a/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
+++ b/core/org.eclipse.cdt.ui/src/org/eclipse/cdt/ui/CUIPreferenceInitializer.java
@@ -45,7 +45,7 @@ public class CUIPreferenceInitializer extends AbstractPreferenceInitializer {
PreferenceConstants.initializeDefaultValues(store);
CPluginPreferencePage.initDefaults(store);
- BuildConsolePreferencePage.initDefaults(store);
+ BuildConsolePreferencePage.initDefaults(store, true);
CView.initDefaults(store);
CEditorPreferencePage.initDefaults(store);
CodeAssistPreferencePage.initDefaults(store);

Back to the top