| /*=============================================================================# |
| # Copyright (c) 2006, 2020 Stephan Wahlbrink and others. |
| # |
| # This program and the accompanying materials are made available under the |
| # terms of the Eclipse Public License 2.0 which is available at |
| # https://www.eclipse.org/legal/epl-2.0, or the Apache License, Version 2.0 |
| # which is available at https://www.apache.org/licenses/LICENSE-2.0. |
| # |
| # SPDX-License-Identifier: EPL-2.0 OR Apache-2.0 |
| # |
| # Contributors: |
| # Stephan Wahlbrink <sw@wahlbrink.eu> - initial API and implementation |
| #=============================================================================*/ |
| |
| package org.eclipse.statet.internal.nico.ui.preferences; |
| |
| import static org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants.TEXTSTYLE_BOLD_SUFFIX; |
| import static org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants.TEXTSTYLE_COLOR_SUFFIX; |
| import static org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants.TEXTSTYLE_ITALIC_SUFFIX; |
| import static org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants.TEXTSTYLE_STRIKETHROUGH_SUFFIX; |
| import static org.eclipse.statet.ecommons.text.ui.presentation.ITextPresentationConstants.TEXTSTYLE_UNDERLINE_SUFFIX; |
| |
| import java.util.EnumSet; |
| |
| import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
| import org.eclipse.core.runtime.preferences.DefaultScope; |
| import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
| import org.eclipse.core.runtime.preferences.IScopeContext; |
| |
| import org.eclipse.statet.ecommons.preferences.core.Preference; |
| import org.eclipse.statet.ecommons.preferences.core.Preference.EnumSetPref; |
| import org.eclipse.statet.ecommons.preferences.core.util.PreferenceUtils; |
| import org.eclipse.statet.ecommons.workbench.ui.IWaThemeConstants; |
| import org.eclipse.statet.ecommons.workbench.ui.util.ThemeUtil; |
| |
| import org.eclipse.statet.nico.core.runtime.SubmitType; |
| import org.eclipse.statet.nico.ui.NicoUIPreferences; |
| |
| |
| public class ConsolePreferences extends AbstractPreferenceInitializer { |
| |
| |
| public static final String GROUP_ID= "nico.console"; //$NON-NLS-1$ |
| |
| public static final String OUTPUT_TEXTSTYLE_GROUP_ID= "nico.console/output/textstyle"; //$NON-NLS-1$ |
| |
| |
| public static final String KEY_HISTORYNAVIGATION_SUBMIT_TYPES= "HistoryNavigation.SubmitTypes.include"; //$NON-NLS-1$ |
| public static final Preference<EnumSet<SubmitType>> HISTORYNAVIGATION_SUBMIT_TYPES_PREF= new EnumSetPref<>( |
| NicoUIPreferences.QUALIFIER, KEY_HISTORYNAVIGATION_SUBMIT_TYPES, SubmitType.class); |
| |
| |
| @Override |
| public void initializeDefaultPreferences() { |
| final IScopeContext scope= DefaultScope.INSTANCE; |
| final IEclipsePreferences outputPrefs= scope.getNode(NicoUIPreferences.OUTPUT_QUALIFIER); |
| final ThemeUtil theme= new ThemeUtil(); |
| |
| PreferenceUtils.setPrefValue(scope, NicoUIPreferences.OUTPUT_CHARLIMIT_PREF, 1000000); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_INFO_STREAM_ROOT_KEY + TEXTSTYLE_COLOR_SUFFIX, |
| theme.getColorPrefValue(IWaThemeConstants.CONSOLE_INFO_COLOR) ); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_INFO_STREAM_ROOT_KEY + TEXTSTYLE_BOLD_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_INFO_STREAM_ROOT_KEY + TEXTSTYLE_ITALIC_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_INFO_STREAM_ROOT_KEY + TEXTSTYLE_UNDERLINE_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_INFO_STREAM_ROOT_KEY + TEXTSTYLE_STRIKETHROUGH_SUFFIX, false); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_STD_INPUT_STREAM_ROOT_KEY + TEXTSTYLE_COLOR_SUFFIX, |
| theme.getColorPrefValue(IWaThemeConstants.CONSOLE_INPUT_COLOR) ); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_INPUT_STREAM_ROOT_KEY + TEXTSTYLE_BOLD_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_INPUT_STREAM_ROOT_KEY + TEXTSTYLE_ITALIC_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_INPUT_STREAM_ROOT_KEY + TEXTSTYLE_UNDERLINE_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_INPUT_STREAM_ROOT_KEY + TEXTSTYLE_STRIKETHROUGH_SUFFIX, false); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_STD_OUTPUT_ROOT_KEY + TEXTSTYLE_COLOR_SUFFIX, |
| theme.getColorPrefValue(IWaThemeConstants.CONSOLE_OUTPUT_COLOR) ); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_OUTPUT_ROOT_KEY + TEXTSTYLE_BOLD_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_OUTPUT_ROOT_KEY + TEXTSTYLE_ITALIC_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_OUTPUT_ROOT_KEY + TEXTSTYLE_UNDERLINE_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_OUTPUT_ROOT_KEY + TEXTSTYLE_STRIKETHROUGH_SUFFIX, false); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_SYSTEM_OUTPUT_STREAM_ROOT_KEY + TEXTSTYLE_COLOR_SUFFIX, |
| theme.getColorPrefValue(IWaThemeConstants.CONSOLE_2ND_OUTPUT_COLOR) ); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_SYSTEM_OUTPUT_STREAM_ROOT_KEY + TEXTSTYLE_BOLD_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_SYSTEM_OUTPUT_STREAM_ROOT_KEY + TEXTSTYLE_ITALIC_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_SYSTEM_OUTPUT_STREAM_ROOT_KEY + TEXTSTYLE_UNDERLINE_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_SYSTEM_OUTPUT_STREAM_ROOT_KEY + TEXTSTYLE_STRIKETHROUGH_SUFFIX, false); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_STD_ERROR_STREAM_ROOT_KEY + TEXTSTYLE_COLOR_SUFFIX, |
| theme.getColorPrefValue(IWaThemeConstants.CONSOLE_ERROR_COLOR) ); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_ERROR_STREAM_ROOT_KEY + TEXTSTYLE_BOLD_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_ERROR_STREAM_ROOT_KEY + TEXTSTYLE_ITALIC_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_ERROR_STREAM_ROOT_KEY + TEXTSTYLE_UNDERLINE_SUFFIX, false); |
| outputPrefs.putBoolean(NicoUIPreferences.OUTPUT_STD_ERROR_STREAM_ROOT_KEY + TEXTSTYLE_STRIKETHROUGH_SUFFIX, false); |
| |
| outputPrefs.put(NicoUIPreferences.OUTPUT_OTHER_TASKS_BACKGROUND_COLOR_KEY, |
| theme.getColorPrefValue("org.eclipse.statet.workbench.themes.CodeRawBackgroundColor") ); //$NON-NLS-1$ |
| |
| PreferenceUtils.setPrefValue(scope, NicoUIPreferences.OUTPUT_FILTER_SUBMITTYPES_INCLUDE_PREF, |
| EnumSet.allOf(SubmitType.class) ); |
| |
| PreferenceUtils.setPrefValue(scope, HISTORYNAVIGATION_SUBMIT_TYPES_PREF, |
| EnumSet.of(SubmitType.CONSOLE) ); |
| } |
| |
| } |