| /*=============================================================================# |
| # Copyright (c) 2007, 2019 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.r.core; |
| |
| import java.util.HashMap; |
| import java.util.Map; |
| |
| import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer; |
| import org.eclipse.core.runtime.preferences.DefaultScope; |
| import org.eclipse.core.runtime.preferences.IScopeContext; |
| |
| import org.eclipse.statet.ecommons.preferences.core.Preference; |
| import org.eclipse.statet.ecommons.preferences.core.util.PreferenceUtils; |
| |
| import org.eclipse.statet.r.core.RCodeStyleSettings; |
| import org.eclipse.statet.r.core.RCore; |
| import org.eclipse.statet.r.core.RProject; |
| |
| |
| /** |
| * Preference Initializer for the preferences of 'StatET R Core' plug-in |
| */ |
| public class RCorePreferenceInitializer extends AbstractPreferenceInitializer { |
| |
| |
| @Override |
| public void initializeDefaultPreferences() { |
| final IScopeContext scope= DefaultScope.INSTANCE; |
| final Map<Preference<?>, Object> map= new HashMap<>(); |
| |
| new RCodeStyleSettings(0).deliverToPreferencesMap(map); |
| |
| PreferenceUtils.setPrefValues(scope, map); |
| |
| PreferenceUtils.setPrefValue(scope, RProject.RENV_CODE_PREF, RCore.DEFAULT_WORKBENCH_ENV_ID); |
| } |
| |
| } |