1 /*******************************************************************************
\r
2 * Copyright (c) 2007, 2011 Association for Decentralized Information Management in
\r
4 * All rights reserved. This program and the accompanying materials
\r
5 * are made available under the terms of the Eclipse Public License v1.0
\r
6 * which accompanies this distribution, and is available at
\r
7 * http://www.eclipse.org/legal/epl-v10.html
\r
10 * VTT Technical Research Centre of Finland - initial API and implementation
\r
11 *******************************************************************************/
\r
12 package org.simantics.workbench.internal.preferences;
\r
14 import org.eclipse.core.runtime.preferences.AbstractPreferenceInitializer;
\r
15 import org.eclipse.core.runtime.preferences.DefaultScope;
\r
16 import org.eclipse.core.runtime.preferences.IScopeContext;
\r
17 import org.eclipse.core.runtime.preferences.InstanceScope;
\r
18 import org.osgi.service.prefs.Preferences;
\r
19 import org.simantics.workbench.internal.Activator;
\r
22 * @author Tuukka Lehtonen
\r
24 public class SimanticsPreferenceInitializer extends AbstractPreferenceInitializer {
\r
27 public void initializeDefaultPreferences() {
\r
28 IScopeContext defaults = DefaultScope.INSTANCE;
\r
29 Preferences node = defaults.getNode(Activator.PLUGIN_ID);
\r
30 node.putBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false);
\r
32 IScopeContext instance = InstanceScope.INSTANCE;
\r
33 node = instance.getNode(Activator.PLUGIN_ID);
\r
34 boolean show = node.getBoolean(SimanticsPreferences.SHOW_DATABASE_CONTROLS, false);
\r
36 System.setProperty(bind(Activator.PLUGIN_ID, SimanticsPreferences.SHOW_DATABASE_CONTROLS), "true");
\r
38 // NOTE: the above system property are used in plugin.xml with
\r
39 // systemTest in menu contribution visibility checking.
\r
40 // This implementation requires a restart every time the preference is changed.
\r
43 private static String bind(String namespace, String pref) {
\r
44 return namespace + "." + pref;
\r